| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160 | 
							- unit BillsGatherFme;
 
- interface
 
- uses
 
-   BillsGatherDm, Globals,
 
-   Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, 
 
-   Dialogs, ZJGrid, ExtCtrls, ZjGridDBA, ZjGridTreeDBA, ComCtrls, ToolWin,
 
-   XPMenu;
 
- type
 
-   TBillsGatherFrame = class(TFrame)
 
-     pnlBillsGather: TPanel;
 
-     zgBillsGather: TZJGrid;
 
-     zdBillsGather: TZjGridDBA;
 
-     pnlRelaXmj: TPanel;
 
-     pnlRelaXmjType: TPanel;
 
-     tbToolsButton: TToolBar;
 
-     tobtnFlatType: TToolButton;
 
-     zgRelaXmj: TZJGrid;
 
-     sprBillsGather: TSplitter;
 
-     zaRelaXmj: TZjGridDBA;
 
-     xpm: TXPMenu;
 
-     procedure zgBillsGatherCellGetColor(Sender: TObject; ACoord: TPoint;
 
-       var AColor: TColor);
 
-   private
 
-     FBillsGatherData: TBillsGatherData;
 
-     FShowPhaseData: Boolean;
 
-     FShowPriceChange: Boolean;
 
-     procedure SetColumnVisible(const AColumn: string; AVisible: Boolean);
 
-     procedure SetShowPhaseData(const Value: Boolean);
 
-     procedure SetShowPriceChange(const Value: Boolean);
 
-   public
 
-     constructor Create(AProjectFrame: TFrame; ABillsGatherData: TBillsGatherData);
 
-     destructor Destroy; override;
 
-     procedure RefreshBills;
 
-     property ShowPriceChange: Boolean read FShowPriceChange write SetShowPriceChange;
 
-     property ShowPhaseData: Boolean read FShowPhaseData write SetShowPhaseData;
 
-   end;
 
- implementation
 
- {$R *.dfm}
 
- { TBillsGatherFrame }
 
- constructor TBillsGatherFrame.Create(AProjectFrame: TFrame;
 
-   ABillsGatherData: TBillsGatherData);
 
- begin
 
-   inherited Create(AProjectFrame);
 
-   FBillsGatherData := ABillsGatherData;
 
-   zdBillsGather.DataSet := FBillsGatherData.cdsBillsGather;
 
-   zaRelaXmj.DataSet := FBillsGatherData.cdsRelaXmj;
 
- end;
 
- destructor TBillsGatherFrame.Destroy;
 
- begin
 
-   inherited;
 
- end;
 
- procedure TBillsGatherFrame.RefreshBills;
 
- begin
 
-   FBillsGatherData.RefreshBills;
 
- end;
 
- procedure TBillsGatherFrame.SetColumnVisible(const AColumn: string;
 
-   AVisible: Boolean);
 
- begin
 
-   if AVisible then
 
-     zdBillsGather.Column(AColumn).Width := 60
 
-   else
 
-     zdBillsGather.Column(AColumn).Width := 0;
 
- end;
 
- procedure TBillsGatherFrame.SetShowPhaseData(const Value: Boolean);
 
- begin
 
-   FShowPhaseData := Value;
 
-   SetColumnVisible('CurDealQuantity', FShowPhaseData);
 
-   SetColumnVisible('CurDealTotalPrice', FShowPhaseData);
 
-   SetColumnVisible('CurQcQuantity', FShowPhaseData);
 
-   SetColumnVisible('CurQcTotalPrice', FShowPhaseData);
 
-   SetColumnVisible('CurPcQuantity', FShowPhaseData and FShowPriceChange);
 
-   SetColumnVisible('CurPcTotalPrice', FShowPhaseData and FShowPriceChange);
 
-   SetColumnVisible('CurGatherQuantity', FShowPhaseData);
 
-   SetColumnVisible('CurGatherTotalPrice', FShowPhaseData);
 
-   SetColumnVisible('EndDealQuantity', FShowPhaseData);
 
-   SetColumnVisible('EndDealTotalPrice', FShowPhaseData);
 
-   SetColumnVisible('EndQcQuantity', FShowPhaseData);
 
-   SetColumnVisible('EndQcTotalPrice', FShowPhaseData);
 
-   SetColumnVisible('EndPcQuantity', FShowPhaseData and FShowPriceChange);
 
-   SetColumnVisible('EndPcTotalPrice', FShowPhaseData and FShowPriceChange);
 
-   SetColumnVisible('EndGatherQuantity', FShowPhaseData);
 
-   SetColumnVisible('EndGatherTotalPrice', FShowPhaseData);
 
- end;
 
- procedure TBillsGatherFrame.SetShowPriceChange(const Value: Boolean);
 
- begin
 
-   FShowPriceChange := Value;
 
-   SetColumnVisible('NewPrice', FShowPriceChange);
 
-   SetColumnVisible('CurPcQuantity', FShowPriceChange and FShowPhaseData);
 
-   SetColumnVisible('CurPcTotalPrice', FShowPriceChange and FShowPhaseData);
 
-   SetColumnVisible('EndPcQuantity', FShowPriceChange and FShowPhaseData);
 
-   SetColumnVisible('EndPcTotalPrice', FShowPriceChange and FShowPhaseData);
 
- end;
 
- procedure TBillsGatherFrame.zgBillsGatherCellGetColor(Sender: TObject;
 
-   ACoord: TPoint; var AColor: TColor);
 
-   function CheckSimilarBills(ARow1, ARow2: Integer): Boolean;
 
-   var
 
-     bHasSame, bHasDiffer: Boolean;
 
-   begin
 
-     bHasSame := SameText(zgBillsGather.Cells[1, ARow1].Text, zgBillsGather.Cells[1, ARow2].Text);
 
-     bHasDiffer := (not SameText(zgBillsGather.Cells[2, ARow1].Text, zgBillsGather.Cells[2, ARow2].Text))
 
-                or (not SameText(zgBillsGather.Cells[3, ARow1].Text, zgBillsGather.Cells[3, ARow2].Text))
 
-                or (not SameText(zgBillsGather.Cells[4, ARow1].Text, zgBillsGather.Cells[4, ARow2].Text));
 
-     Result := bHasSame and bHasDiffer;
 
-   end;
 
-   function CheckOverRange(ARow: Integer): Boolean;
 
-   var
 
-     fQuantity, fDealQuantity, fEndDealQuantity: Double;
 
-   begin
 
-     fDealQuantity := StrToFloatDef(zgBillsGather.Cells[6, ARow].Text, 0);
 
-     fQuantity := StrToFloatDef(zgBillsGather.Cells[8, ARow].Text, 0);
 
-     fEndDealQuantity := StrToFloatDef(zgBillsGather.Cells[18, ARow].Text, 0);
 
-     case SupportManager.ConfigInfo.OverRangeType of
 
-       0: Result := fEndDealQuantity > fQuantity;
 
-       1: Result := fEndDealQuantity > fDealQuantity;
 
-       2: Result := (fEndDealQuantity > fQuantity) or (fEndDealQuantity > fDealQuantity);
 
-     end;
 
-   end;
 
- var
 
-   bSimilarBills: Boolean;
 
- begin
 
-   if ACoord.Y >= zgBillsGather.FixedRowCount then
 
-   begin
 
-     if ACoord.Y = zgBillsGather.FixedRowCount then
 
-       bSimilarBills := CheckSimilarBills(ACoord.Y, ACoord.Y + 1)
 
-     else if ACoord.Y < zgBillsGather.RowCount - zgBillsGather.FixedRowCount then
 
-       bSimilarBills := CheckSimilarBills(ACoord.Y, ACoord.Y - 1) or
 
-           CheckSimilarBills(ACoord.Y, ACoord.Y + 1)
 
-     else
 
-       bSimilarBills := CheckSimilarBills(ACoord.Y, ACoord.Y - 1);
 
-     {if bSimilarBills then
 
-       AColor := $00646AFE;}
 
-      if bSimilarBills then
 
-        AColor := $0000FFFF; // »ÆÉ«
 
-      if CheckOverRange(ACoord.Y) then
 
-        AColor := $00505AFF; // ºìÉ«
 
-   end;
 
- end;
 
- end.
 
 
  |