|
|
|
|
unit u_ch_precost;
|
|
|
|
|
|
|
|
|
|
interface
|
|
|
|
|
|
|
|
|
|
uses
|
|
|
|
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|
|
|
|
Dialogs, dxExEdtr, DB, ADODB, u_ch_add_do, u_ch_delete_do, StdCtrls,
|
|
|
|
|
DBCtrls, wwdblook, ComCtrls, bsSkinTabs, RxLookup, bsSkinCtrls,
|
|
|
|
|
bsdbctrls, Mask, dxDBGrid, dxDBTLCl, dxGrClms, dxTL, dxDBCtrl, dxCntner,
|
|
|
|
|
Menus, XPMenu, wwdbdatetimepicker, wwdbedit, Wwdotdot, Wwdbcomb,
|
|
|
|
|
kbmMemTable, bsSkinBoxCtrls, DBCtrlsEh;
|
|
|
|
|
|
|
|
|
|
type
|
|
|
|
|
Tfrm_ch_precost = class(TForm)
|
|
|
|
|
bsSkinPanel2: TbsSkinPanel;
|
|
|
|
|
bsSkinButton1: TbsSkinButton;
|
|
|
|
|
bsSkinButton2: TbsSkinButton;
|
|
|
|
|
bsSkinButton4: TbsSkinButton;
|
|
|
|
|
bsSkinButton3: TbsSkinButton;
|
|
|
|
|
bsSkinButton5: TbsSkinButton;
|
|
|
|
|
bsSkinButton9: TbsSkinButton;
|
|
|
|
|
bsSkinButton10: TbsSkinButton;
|
|
|
|
|
bsSkinButton11: TbsSkinButton;
|
|
|
|
|
bsSkinButton6: TbsSkinButton;
|
|
|
|
|
bsSkinNotebook1: TbsSkinNotebook;
|
|
|
|
|
dxdbgrid1: TdxDBGrid;
|
|
|
|
|
bsSkinPanel1: TbsSkinPanel;
|
|
|
|
|
t_ch_precost: TADOQuery;
|
|
|
|
|
t_ch_precost1: TDataSource;
|
|
|
|
|
t_ch_fee_do_precost: TADOQuery;
|
|
|
|
|
dxdbgrid1Column1: TdxDBGridMaskColumn;
|
|
|
|
|
dxdbgrid1Column2: TdxDBGridMaskColumn;
|
|
|
|
|
dxdbgrid1Column3: TdxDBGridMaskColumn;
|
|
|
|
|
dxdbgrid1Column10: TdxDBGridMaskColumn;
|
|
|
|
|
dxdbgrid1Column11: TdxDBGridDateColumn;
|
|
|
|
|
XPMenu1: TXPMenu;
|
|
|
|
|
PopupMenu2: TPopupMenu;
|
|
|
|
|
N16: TMenuItem;
|
|
|
|
|
dxdbgrid1Column18: TdxDBGridColumn;
|
|
|
|
|
dxdbgrid1Column19: TdxDBGridColumn;
|
|
|
|
|
memtblprint1: TDataSource;
|
|
|
|
|
memtblprint: TkbmMemTable;
|
|
|
|
|
bsSkinButton38: TbsSkinButton;
|
|
|
|
|
DBEdit12: TDBEdit;
|
|
|
|
|
PopupMenu1: TPopupMenu;
|
|
|
|
|
MenuItem4: TMenuItem;
|
|
|
|
|
MenuItem5: TMenuItem;
|
|
|
|
|
N21: TMenuItem;
|
|
|
|
|
N22: TMenuItem;
|
|
|
|
|
N20: TMenuItem;
|
|
|
|
|
N2: TMenuItem;
|
|
|
|
|
N3: TMenuItem;
|
|
|
|
|
dxdbgrid1Column27: TdxDBGridColumn;
|
|
|
|
|
Label9: TLabel;
|
|
|
|
|
Label11: TLabel;
|
|
|
|
|
Label14: TLabel;
|
|
|
|
|
Label16: TLabel;
|
|
|
|
|
Label20: TLabel;
|
|
|
|
|
Label22: TLabel;
|
|
|
|
|
DBEdit5: TDBEdit;
|
|
|
|
|
DBEdit9: TDBEdit;
|
|
|
|
|
RxDBLookupCombo3: TRxDBLookupCombo;
|
|
|
|
|
DBEdit10: TDBEdit;
|
|
|
|
|
DBEdit11: TDBEdit;
|
|
|
|
|
DBMemo2: TDBMemo;
|
|
|
|
|
bsSkinButton21: TbsSkinButton;
|
|
|
|
|
bsSkinPanel3: TbsSkinPanel;
|
|
|
|
|
dxDBGrid2: TdxDBGrid;
|
|
|
|
|
dxDBGrid2Column1: TdxDBGridColumn;
|
|
|
|
|
dxDBGrid2Column2: TdxDBGridColumn;
|
|
|
|
|
dxDBGrid2Column3: TdxDBGridColumn;
|
|
|
|
|
dxDBGrid2Column4: TdxDBGridColumn;
|
|
|
|
|
dxDBGrid2Column5: TdxDBGridColumn;
|
|
|
|
|
dxDBGrid2Column6: TdxDBGridColumn;
|
|
|
|
|
bsSkinPanel4: TbsSkinPanel;
|
|
|
|
|
Label1: TLabel;
|
|
|
|
|
Label2: TLabel;
|
|
|
|
|
Label3: TLabel;
|
|
|
|
|
Label12: TLabel;
|
|
|
|
|
Label4: TLabel;
|
|
|
|
|
Label125: TLabel;
|
|
|
|
|
Label30: TLabel;
|
|
|
|
|
Label35: TLabel;
|
|
|
|
|
Edit4: TEdit;
|
|
|
|
|
Edit2: TEdit;
|
|
|
|
|
wwDBDateTimePicker1: TwwDBDateTimePicker;
|
|
|
|
|
wwDBDateTimePicker2: TwwDBDateTimePicker;
|
|
|
|
|
bsSkinButton7: TbsSkinButton;
|
|
|
|
|
bsSkinButton8: TbsSkinButton;
|
|
|
|
|
Edit16: TEdit;
|
|
|
|
|
bsSkinPanel5: TbsSkinPanel;
|
|
|
|
|
dxDBGrid3: TdxDBGrid;
|
|
|
|
|
dxDBGridColumn1: TdxDBGridColumn;
|
|
|
|
|
dxDBGridColumn2: TdxDBGridColumn;
|
|
|
|
|
dxDBGridColumn3: TdxDBGridColumn;
|
|
|
|
|
dxDBGridColumn4: TdxDBGridColumn;
|
|
|
|
|
dxDBGridColumn5: TdxDBGridColumn;
|
|
|
|
|
dxDBGridColumn6: TdxDBGridColumn;
|
|
|
|
|
dxDBGridColumn7: TdxDBGridColumn;
|
|
|
|
|
Label38: TLabel;
|
|
|
|
|
wwDBComboBox42: TwwDBComboBox;
|
|
|
|
|
RxDBLookupCombo5: TRxDBLookupCombo;
|
|
|
|
|
t_ch_fee_do_precost1: TDataSource;
|
|
|
|
|
memtblItems: TkbmMemTable;
|
|
|
|
|
memtblItems1: TDataSource;
|
|
|
|
|
memtblItemsField: TBooleanField;
|
|
|
|
|
memtblItemsField2: TStringField;
|
|
|
|
|
memtblItemsField3: TStringField;
|
|
|
|
|
memtblItemsField4: TStringField;
|
|
|
|
|
memtblItemsField5: TStringField;
|
|
|
|
|
memtblItemsField6: TStringField;
|
|
|
|
|
memtblItemsField7: TFloatField;
|
|
|
|
|
memtblItemsField8: TFloatField;
|
|
|
|
|
memtblItemsch_id: TIntegerField;
|
|
|
|
|
memtblItemsField9: TStringField;
|
|
|
|
|
dxDBGrid3Column8: TdxDBGridCheckColumn;
|
|
|
|
|
bsSkinButton13: TbsSkinButton;
|
|
|
|
|
bsSkinButton14: TbsSkinButton;
|
|
|
|
|
bsSkinButton15: TbsSkinButton;
|
|
|
|
|
dxDBGrid2Column7: TdxDBGridColumn;
|
|
|
|
|
Label5: TLabel;
|
|
|
|
|
DBEdit1: TDBEdit;
|
|
|
|
|
bsSkinButton16: TbsSkinButton;
|
|
|
|
|
memtblItemsField10: TFloatField;
|
|
|
|
|
dxDBGrid3Column9: TdxDBGridColumn;
|
|
|
|
|
bsSkinButton17: TbsSkinButton;
|
|
|
|
|
Label26: TLabel;
|
|
|
|
|
wwDBDateTimePicker3: TwwDBDateTimePicker;
|
|
|
|
|
t_cw_design: TADOQuery;
|
|
|
|
|
dxdbgrid1Column9: TdxDBGridColumn;
|
|
|
|
|
RxDBLookupCombo16: TRxDBLookupCombo;
|
|
|
|
|
ComboBox1: TComboBox;
|
|
|
|
|
ComboBox2: TComboBox;
|
|
|
|
|
memtblItemsField11: TDateField;
|
|
|
|
|
dxDBGrid3Column10: TdxDBGridColumn;
|
|
|
|
|
dxDBGrid2Column8: TdxDBGridColumn;
|
|
|
|
|
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
|
|
|
|
procedure FormShow(Sender: TObject);
|
|
|
|
|
procedure bsSkinButton11Click(Sender: TObject);
|
|
|
|
|
procedure t_ch_precostAfterInsert(DataSet: TDataSet);
|
|
|
|
|
procedure bsSkinButton1Click(Sender: TObject);
|
|
|
|
|
procedure bsSkinButton2Click(Sender: TObject);
|
|
|
|
|
procedure bsSkinButton4Click(Sender: TObject);
|
|
|
|
|
procedure bsSkinButton3Click(Sender: TObject);
|
|
|
|
|
procedure t_ch_precostBeforePost(DataSet: TDataSet);
|
|
|
|
|
procedure t_ch_precostBeforeEdit(DataSet: TDataSet);
|
|
|
|
|
procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
|
|
|
|
|
procedure bsSkinButton9Click(Sender: TObject);
|
|
|
|
|
procedure bsSkinButton5Click(Sender: TObject);
|
|
|
|
|
procedure N16Click(Sender: TObject);
|
|
|
|
|
procedure bsSkinPanel2Resize(Sender: TObject);
|
|
|
|
|
procedure bsSkinButton38Click(Sender: TObject);
|
|
|
|
|
procedure DBEdit12Change(Sender: TObject);
|
|
|
|
|
procedure bsSkinButton8Click(Sender: TObject);
|
|
|
|
|
procedure bsSkinButton7Click(Sender: TObject);
|
|
|
|
|
procedure bsSkinButton13Click(Sender: TObject);
|
|
|
|
|
procedure bsSkinButton14Click(Sender: TObject);
|
|
|
|
|
procedure bsSkinButton15Click(Sender: TObject);
|
|
|
|
|
procedure dxDBGrid3SelectedCountChange(Sender: TObject);
|
|
|
|
|
procedure bsSkinButton16Click(Sender: TObject);
|
|
|
|
|
procedure bsSkinButton17Click(Sender: TObject);
|
|
|
|
|
procedure dxdbgrid1Column2CustomDraw(Sender: TObject; ACanvas: TCanvas;
|
|
|
|
|
ARect: TRect; ANode: TdxTreeListNode; AColumn: TdxDBTreeListColumn;
|
|
|
|
|
const AText: String; AFont: TFont; var AColor: TColor; ASelected,
|
|
|
|
|
AFocused: Boolean; var ADone: Boolean);
|
|
|
|
|
procedure DBEdit9Change(Sender: TObject);
|
|
|
|
|
procedure dxDBGrid3CustomDraw(Sender: TObject; ACanvas: TCanvas;
|
|
|
|
|
ARect: TRect; ANode: TdxTreeListNode; AColumn: TdxDBTreeListColumn;
|
|
|
|
|
const AText: String; AFont: TFont; var AColor: TColor; ASelected,
|
|
|
|
|
AFocused: Boolean; var ADone: Boolean);
|
|
|
|
|
procedure dxDBGrid3DblClick(Sender: TObject);
|
|
|
|
|
private
|
|
|
|
|
{ Private declarations }
|
|
|
|
|
public
|
|
|
|
|
{ Public declarations }
|
|
|
|
|
function GetCustID(CorpID,DC:String):String;
|
|
|
|
|
procedure UpdateBillAmt;
|
|
|
|
|
procedure NewDCVou_One;
|
|
|
|
|
function NewDCVou_Patch(fDataSet:TDataSet;ZDR:String;voudate:TDatetime):Boolean;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
var
|
|
|
|
|
ch_check_shen_open:boolean;
|
|
|
|
|
frm_ch_precost: Tfrm_ch_precost;
|
|
|
|
|
|
|
|
|
|
implementation
|
|
|
|
|
|
|
|
|
|
uses u_main, u_ch_shen_query, my_sys_function, u_data_share, my_sys_chat,u_op_kuaidi_shen,
|
|
|
|
|
dmAccu, VouItemStlu;
|
|
|
|
|
|
|
|
|
|
{$R *.dfm}
|
|
|
|
|
|
|
|
|
|
function Tfrm_ch_precost.GetCustID(CorpID,DC:String):String;
|
|
|
|
|
var
|
|
|
|
|
i:integer;
|
|
|
|
|
aQuery:TADOQuery;
|
|
|
|
|
begin
|
|
|
|
|
aQuery:=createADOQuery;
|
|
|
|
|
with aQuery do
|
|
|
|
|
try
|
|
|
|
|
Close;SQL.Clear;
|
|
|
|
|
SQL.Add('select <20><><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD>ʿ<EFBFBD><CABF><EFBFBD><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD>ʿ<EFBFBD><CABF><EFBFBD><EFBFBD><EFBFBD> from t_crm_client where <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>='''+CorpID+'''');
|
|
|
|
|
Open;
|
|
|
|
|
if DC='<27><>' then
|
|
|
|
|
Result:=fieldByName('<27><><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD>ʿ<EFBFBD><CABF><EFBFBD><EFBFBD><EFBFBD>').AsString
|
|
|
|
|
else
|
|
|
|
|
Result:=fieldByName('<27><><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD>ʿ<EFBFBD><CABF><EFBFBD><EFBFBD><EFBFBD>').AsString;
|
|
|
|
|
if result='' then begin
|
|
|
|
|
showmessage(CorpID+' '+DC+' '+'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>');
|
|
|
|
|
Abort;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
finally
|
|
|
|
|
FreeAndNil(aQuery);
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
function Tfrm_ch_precost.NewDCVou_Patch(fDataSet:TDataSet;ZDR:String;voudate:TDatetime):Boolean;
|
|
|
|
|
var
|
|
|
|
|
aQuery,aQuery2:TADOQuery;
|
|
|
|
|
mAccOK:Boolean;
|
|
|
|
|
aModal:TModalResult;
|
|
|
|
|
StlAmtDR,StlAmtCR,StlUSDAmtDR,StlUSDAmtCR,UsdExRate:Double;
|
|
|
|
|
AmtDR,AmtCR,USDAmtDR,USDAmtCR,amtvat:Double;
|
|
|
|
|
ordno:integer;
|
|
|
|
|
MBlNo,Explan:string;
|
|
|
|
|
begin
|
|
|
|
|
Result:=false;
|
|
|
|
|
aQuery:=CreateADOQuery;
|
|
|
|
|
aQuery2:=CreateADOQuery;
|
|
|
|
|
StlAmtDR:=0.00;
|
|
|
|
|
StlAmtCR:=0.00;
|
|
|
|
|
StlUSDAmtDR:=0.00;
|
|
|
|
|
StlUSDAmtCR:=0.00;
|
|
|
|
|
UsdExRate:=StrToFloatDef(DBEdit1.Text,7.8);
|
|
|
|
|
amtvat:=0.00;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Explan:='';
|
|
|
|
|
with aQuery,SQL do
|
|
|
|
|
begin
|
|
|
|
|
Close;Clear;
|
|
|
|
|
Add('Select V_op_bscard_All.ί<>б<EFBFBD><D0B1><EFBFBD>,t_ch_fee.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>,t_crm_client.<2E>ͻ<EFBFBD>ȫ<EFBFBD><C8AB>');
|
|
|
|
|
Add(',t_ch_fee_do_precost.<2E>ұ<EFBFBD>,sum(t_ch_fee_do_precost.<2E><><EFBFBD><EFBFBD>) <20><><EFBFBD><EFBFBD>');
|
|
|
|
|
Add('FROM t_ch_fee_do_precost');
|
|
|
|
|
Add('INNER JOIN t_ch_fee ON t_ch_fee_do_precost.CH_ID = t_ch_fee.CH_ID');
|
|
|
|
|
Add('LEFT JOIN V_op_bscard_All ON t_ch_fee_do_precost.ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD> = V_op_bscard_All.<2E><><EFBFBD><EFBFBD>');
|
|
|
|
|
Add('Left Join t_crm_client on t_ch_fee.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>=t_crm_client.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>');
|
|
|
|
|
Add('where t_ch_fee_do_precost.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>='''+fDataSet.fieldbyName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString+'''');
|
|
|
|
|
Add('group by V_op_bscard_All.ί<>б<EFBFBD><D0B1><EFBFBD>,t_ch_fee.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>,t_crm_client.<2E>ͻ<EFBFBD>ȫ<EFBFBD><C8AB>,t_ch_fee_do_precost.<2E>ұ<EFBFBD>');
|
|
|
|
|
Open;
|
|
|
|
|
end;
|
|
|
|
|
OrdNo:=dmAcc.AdotblVou.fieldByName('OrdNo').AsInteger;
|
|
|
|
|
dmAcc.AdotblVouItems.Open;
|
|
|
|
|
aQuery.First;
|
|
|
|
|
while not aQuery.Eof do
|
|
|
|
|
begin
|
|
|
|
|
dmAcc.AdotblVouItems.Insert;
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('AccID').AsString:='5121.021'; //<2F>ɱ<EFBFBD>
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('QTYSPECS').AsString:=trim(t_cw_design.fieldbyname('<27><>Ӧ<EFBFBD>̺<EFBFBD><CCBA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString);
|
|
|
|
|
if aQuery.FieldByName('<27>ұ<EFBFBD>').AsString='USD' then
|
|
|
|
|
begin
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('FCYDr').AsFloat:=StrToFloatDef(FormatFloat('0.00;-0.00;0.0',aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat),0);
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('FCYEXRATE').AsFloat:=UsdExRate;
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('FCYCr').AsFloat:=0.0;
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('AmtCr').AsFloat:=0.0;
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('FCYNO').AsString:='RMB';
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('AmtDr').AsFloat:=StrToFloatDef(FormatFloat('0.00;-0.00;0.0', StrToFloat(FloatToStr(aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat*UsdExRate))), 0);
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
begin
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('AmtCr').AsFloat:=0.0;
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('AmtDR').AsFloat:=StrToFloatDef(FormatFloat('0.00;-0.00;0.0',aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat),0);
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('FCYDR').AsFloat:=0.0;
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('FCYCr').AsFloat:=0.0;
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('FCYEXRATE').AsFloat:=0.0;
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('FCYNO').AsString:='RMB';
|
|
|
|
|
end;
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('BSNO').AsString:=aQuery.fieldByName('ί<>б<EFBFBD><D0B1><EFBFBD>').AsString;
|
|
|
|
|
Explan:=getstrfromdataset(aQuery,t_cw_design.fieldByName('<27><><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6>ժҪ').AsString);
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('EXPLAN').AsString:='Ԥ<><D4A4>'+Explan;
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('CorpID').AsString:=GetCustID(aQuery.fieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString,'<27><>');
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('CorpBf').AsString:='F';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
dmAcc.AdotblVouItems.post;
|
|
|
|
|
|
|
|
|
|
dmAcc.AdotblVouItems.Insert;
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('QTYSPECS').AsString:=trim(t_cw_design.fieldbyname('<27><>Ӧ<EFBFBD>̺<EFBFBD><CCBA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString);
|
|
|
|
|
if aQuery.FieldByName('<27>ұ<EFBFBD>').AsString='USD' then
|
|
|
|
|
begin
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('AccID').AsString:=t_cw_design.fieldbyname('Ӧ<><D3A6><EFBFBD>˿<EFBFBD><CBBF><EFBFBD><EFBFBD><EFBFBD>').AsString;
|
|
|
|
|
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('FCYNO').AsString:='USD';
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('FCYEXRATE').AsFloat:=UsdExRate;
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('FCYDR').AsFloat:=0.0;
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('FCYCr').AsFloat:=StrToFloatDef(FormatFloat('0.00;-0.00;0.0',aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat),0);
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('AmtDr').AsFloat:=0.0;
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('AmtCr').AsFloat:=StrToFloatDef(FormatFloat('0.00;-0.00;0.0', StrToFloat(FloatToStr(aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat*UsdExRate))), 0);
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
begin
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('AccID').AsString:=t_cw_design.fieldbyname('Ӧ<><D3A6><EFBFBD>˿<EFBFBD>').AsString;
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('FCYNO').AsString:='RMB';
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('AmtDr').AsFloat:=0.0;
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('AmtCR').AsFloat:=StrToFloatDef(FormatFloat('0.00;-0.00;0.0',aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat),0);
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('FCYCR').AsFloat:=0.0;
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('FCYCr').AsFloat:=0.0;
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('FCYEXRATE').AsFloat:=0.0;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('BSNO').AsString:=aQuery.fieldByName('ί<>б<EFBFBD><D0B1><EFBFBD>').AsString;
|
|
|
|
|
Explan:=getstrfromdataset(aQuery,t_cw_design.fieldByName('<27><><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6>ժҪ').AsString);
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('EXPLAN').AsString:=Explan;
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('CorpID').AsString:=GetCustID(aQuery.fieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString,'<27><>');
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('CorpBf').AsString:='F';
|
|
|
|
|
dmAcc.AdotblVouItems.post;
|
|
|
|
|
aQuery.next;
|
|
|
|
|
end;
|
|
|
|
|
FreeAndNil(aQuery);
|
|
|
|
|
end;
|
|
|
|
|
procedure Tfrm_ch_precost.NewDCVou_One;
|
|
|
|
|
var
|
|
|
|
|
i,ordno:integer;
|
|
|
|
|
aQuery:TAdoQuery;
|
|
|
|
|
aModal:TModalResult;
|
|
|
|
|
mAccOK:boolean;
|
|
|
|
|
begin
|
|
|
|
|
if wwDBDateTimePicker3.Text='' then begin
|
|
|
|
|
MessageDlg('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ü<EFBFBD><C3BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڣ<EFBFBD>',mterror,[mbyes],0);
|
|
|
|
|
exit;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if DBEdit1.Text='' then begin
|
|
|
|
|
MessageDlg('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƾ֤<C6BE><D6A4><EFBFBD>ʣ<EFBFBD>',mterror,[mbyes],0);
|
|
|
|
|
exit;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
if t_ch_fee_do_precost.IsEmpty then Exit;
|
|
|
|
|
|
|
|
|
|
dmacc:=TdmAcc.Create(self);
|
|
|
|
|
aQuery:=CreateAdoQuery;
|
|
|
|
|
|
|
|
|
|
// try
|
|
|
|
|
dmAcc.ADOtblVou.Open;
|
|
|
|
|
dmAcc.ADOtblVouItems.Open;
|
|
|
|
|
aVKNO:=1;
|
|
|
|
|
aQuery.Close;
|
|
|
|
|
aQuery.SQL.Clear;
|
|
|
|
|
aQuery.SQL.add('update t_ch_precost set <20><><EFBFBD><EFBFBD>=1,<2C><><EFBFBD><EFBFBD>ƾ֤=:<3A><><EFBFBD><EFBFBD>ƾ֤,<2C><><EFBFBD><EFBFBD>״̬=''<27><><EFBFBD><EFBFBD>ƾ֤'' where <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>=:<3A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
|
|
|
|
VoucherDate:=wwDBDateTimePicker3.Date;
|
|
|
|
|
// try
|
|
|
|
|
dmAcc.AdotblVou.Insert;
|
|
|
|
|
dmAcc.AdotblVou.FieldByName('SourceType').AsInteger:=4;
|
|
|
|
|
dmAcc.AdotblVou.FieldByName('ATTACHS').AsInteger:=AccInfo.ATTACHS;
|
|
|
|
|
|
|
|
|
|
if Trim(t_cw_design.FieldByName('ת<><D7AA>ƾ֤<C6BE><D6A4>').AsString)<>'' then
|
|
|
|
|
begin
|
|
|
|
|
dmAcc.AdotblVou.FieldByName('VKNO').AsString:=Trim(t_cw_design.FieldByName('ת<><D7AA>ƾ֤<C6BE><D6A4>').AsString);
|
|
|
|
|
end
|
|
|
|
|
else dmAcc.AdotblVou.FieldByName('VKNO').AsString:='<27><>';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
dmAcc.AdotblVou.FieldByName('PREPARED').AsString:=employee;
|
|
|
|
|
dmAcc.AdotblVou.Post;
|
|
|
|
|
dmAcc.AdotblVou.Edit;
|
|
|
|
|
|
|
|
|
|
NewDCVou_Patch(t_ch_precost,employee,wwDBDateTimePicker3.Date);
|
|
|
|
|
aQuery.Parameters.ParamByName('<27><><EFBFBD><EFBFBD>ƾ֤').Value:=dmacc.ADOTblVou.fieldbyname('ordno').AsString;
|
|
|
|
|
aQuery.Parameters.ParamByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').Value:=t_ch_precost.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString;
|
|
|
|
|
aQuery.ExecSQL;
|
|
|
|
|
|
|
|
|
|
ordno:=dmAcc.AdotblVou.fieldbyname('ordno').asinteger;
|
|
|
|
|
dmAcc.AdotblVou.Post;
|
|
|
|
|
FrmVouItemStl:=TFrmVouItemStl.Create(Application);
|
|
|
|
|
// try
|
|
|
|
|
dmACC.AdotblVouItems.Last;
|
|
|
|
|
FrmVouItemStl.DBGridVouItems.SelectedField:=dmACC.AdotblVouItems.FieldByName('AccID');
|
|
|
|
|
FrmVouItemStl.ShowModal;
|
|
|
|
|
mAccOK:=false;
|
|
|
|
|
aModal:=frmVouItemStl.ModalResult;
|
|
|
|
|
mAccOK:=aModal=mrok;
|
|
|
|
|
if mAccOK then begin
|
|
|
|
|
if dmAcc.AdotblVouItems.State in [dsEdit,dsInsert] then
|
|
|
|
|
dmAcc.AdotblVouItems.Post;
|
|
|
|
|
if dmAcc.AdotblVou.State in [dsEdit,dsInsert] then
|
|
|
|
|
dmAcc.AdotblVou.Post;
|
|
|
|
|
end else begin
|
|
|
|
|
dmAcc.TempQuery.Close;
|
|
|
|
|
dmAcc.TempQuery.SQL.Clear;
|
|
|
|
|
dmAcc.TempQuery.SQL.Add('delete from vouchers where ordno=:mOrdNo');
|
|
|
|
|
dmAcc.TempQuery.Parameters.ParamByName('mOrdNo').value:=OrdNo;
|
|
|
|
|
dmAcc.TempQuery.ExecSQL;
|
|
|
|
|
dmAcc.TempQuery.Close;
|
|
|
|
|
dmAcc.TempQuery.SQL.Clear;
|
|
|
|
|
dmAcc.TempQuery.SQL.Add('update t_ch_precost set <20><><EFBFBD><EFBFBD>״̬=''¼<><C2BC>״̬'' , <20><><EFBFBD><EFBFBD>=0,<2C><><EFBFBD><EFBFBD>ƾ֤='''' where <20><><EFBFBD><EFBFBD>ƾ֤='''+inttostr(OrdNo)+'''');
|
|
|
|
|
dmAcc.TempQuery.ExecSQL;
|
|
|
|
|
end;
|
|
|
|
|
// finally
|
|
|
|
|
freeAndNil(FrmVouItemStl);
|
|
|
|
|
// end;
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
except
|
|
|
|
|
dmAcc.TempQuery.Close;
|
|
|
|
|
dmAcc.TempQuery.SQL.Clear;
|
|
|
|
|
dmAcc.TempQuery.SQL.Add('delete from vouchers where ordno=:mOrdNo');
|
|
|
|
|
dmAcc.TempQuery.Parameters.ParamByName('mOrdNo').value:=OrdNo;
|
|
|
|
|
dmAcc.TempQuery.ExecSQL;
|
|
|
|
|
end;
|
|
|
|
|
}
|
|
|
|
|
// finally
|
|
|
|
|
dmAcc.AdotblVouItems.Close;
|
|
|
|
|
dmAcc.AdotblVou.Close;
|
|
|
|
|
freeAndNil(dmacc);
|
|
|
|
|
// end;
|
|
|
|
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure Tfrm_ch_precost.FormClose(Sender: TObject;
|
|
|
|
|
var Action: TCloseAction);
|
|
|
|
|
begin
|
|
|
|
|
ch_check_shen_open:=false;
|
|
|
|
|
savereggrid(dxdbgrid1,caption+'1');
|
|
|
|
|
frm_ch_precost.Hide;
|
|
|
|
|
frm_ch_precost.ManualFloat(frm_ch_precost.BoundsRect );
|
|
|
|
|
frm_main.freeTabs('frm_ch_precost');
|
|
|
|
|
action:=cafree;
|
|
|
|
|
frm_ch_precost:=nil;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure Tfrm_ch_precost.FormShow(Sender: TObject);
|
|
|
|
|
begin
|
|
|
|
|
wwDBComboBox42.Text:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
|
|
|
|
|
RxDBLookupCombo16.Value:='PHF';
|
|
|
|
|
bsSkinNotebook1.PageIndex:=0;
|
|
|
|
|
t_ch_precost.Close;
|
|
|
|
|
t_ch_precost.SQL.clear;
|
|
|
|
|
t_ch_precost.SQL.Add('select * from t_ch_precost where <20><><EFBFBD><EFBFBD>״̬ not in ('+''''+'<27><>֧<D7BC><D6A7>'+''''
|
|
|
|
|
+','+''''+'֧<><D6A7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'+''''+') and '
|
|
|
|
|
+open_data('1003','<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','no','no','no','no')
|
|
|
|
|
+'order by <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> desc');
|
|
|
|
|
t_ch_precost.open;
|
|
|
|
|
t_ch_fee_do_precost.Close;
|
|
|
|
|
t_ch_fee_do_precost.Open;
|
|
|
|
|
ch_check_shen_open:=true;
|
|
|
|
|
t_cw_design.Open;
|
|
|
|
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure Tfrm_ch_precost.bsSkinButton11Click(Sender: TObject);
|
|
|
|
|
var
|
|
|
|
|
answer:TModalResult;
|
|
|
|
|
begin
|
|
|
|
|
if bsSkinButton11.Caption='<27>༭<EFBFBD><EFBFBD>' then
|
|
|
|
|
begin
|
|
|
|
|
if t_ch_precost.IsEmpty then
|
|
|
|
|
exit;
|
|
|
|
|
bsSkinNotebook1.PageIndex:=1;
|
|
|
|
|
bsSkinButton11.Caption:='<27><><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>';
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
begin
|
|
|
|
|
if (t_ch_precost.State=dsinsert)or(t_ch_precost.State=dsedit) then
|
|
|
|
|
BEGIN
|
|
|
|
|
answer:=messagedlg( '<27><><EFBFBD><EFBFBD><EFBFBD>Ѿ<EFBFBD><D1BE>ģ<DEB8><C4A3>Ƿ棿',mtWarning,mbYesNoCancel,0);
|
|
|
|
|
if answer=mrYes then
|
|
|
|
|
begin
|
|
|
|
|
t_ch_precost.post;
|
|
|
|
|
end;
|
|
|
|
|
if answer=mrNo then
|
|
|
|
|
begin
|
|
|
|
|
t_ch_precost.cancel;
|
|
|
|
|
end;
|
|
|
|
|
if answer=mrCancel then
|
|
|
|
|
begin
|
|
|
|
|
exit;
|
|
|
|
|
end;
|
|
|
|
|
END;
|
|
|
|
|
bsSkinNotebook1.PageIndex:=0;
|
|
|
|
|
bsSkinButton11.Caption:='<27>༭<EFBFBD><EFBFBD>';
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure Tfrm_ch_precost.t_ch_precostAfterInsert(DataSet: TDataSet);
|
|
|
|
|
begin
|
|
|
|
|
t_ch_precost['<27><><EFBFBD><EFBFBD>״̬']:='¼<><C2BC>״̬';
|
|
|
|
|
t_ch_precost['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=employee;
|
|
|
|
|
t_ch_precost['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=now;
|
|
|
|
|
t_ch_precost['ƾ֤<C6BE><D6A4><EFBFBD><EFBFBD>']:=date;
|
|
|
|
|
t_ch_precost['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:='';
|
|
|
|
|
IF frm_data_share.t_code_currency.Locate('<27>ұ<EFBFBD>','USD',[])THEN
|
|
|
|
|
begin
|
|
|
|
|
t_ch_precost['<27><><EFBFBD><EFBFBD>']:=frm_data_share.t_code_currency.fieldbyname('<27><><EFBFBD><EFBFBD>').asfloat;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure Tfrm_ch_precost.bsSkinButton1Click(Sender: TObject);
|
|
|
|
|
begin
|
|
|
|
|
t_ch_precost.insert;
|
|
|
|
|
bsSkinNotebook1.PageIndex:=1;
|
|
|
|
|
|
|
|
|
|
bsSkinButton11.Caption:='<27><><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>';
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure Tfrm_ch_precost.bsSkinButton2Click(Sender: TObject);
|
|
|
|
|
begin
|
|
|
|
|
table_post(t_ch_precost);
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure Tfrm_ch_precost.bsSkinButton4Click(Sender: TObject);
|
|
|
|
|
begin
|
|
|
|
|
if t_ch_precost.IsEmpty then
|
|
|
|
|
exit;
|
|
|
|
|
|
|
|
|
|
if not t_ch_fee_do_precost.IsEmpty then
|
|
|
|
|
begin
|
|
|
|
|
showmessage('<27><><EFBFBD>ڷ<EFBFBD><DAB7><EFBFBD><EFBFBD><EFBFBD>ϸ<EFBFBD><CFB8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɾ<EFBFBD><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɾ<EFBFBD><C9BE><EFBFBD><EFBFBD>ϸ<EFBFBD><CFB8><EFBFBD>ݣ<EFBFBD><DDA3><EFBFBD>');
|
|
|
|
|
exit;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
if (t_ch_precost.FieldByName('<27><><EFBFBD><EFBFBD>״̬').asstring='<27><><EFBFBD><EFBFBD>ƾ֤') then
|
|
|
|
|
begin
|
|
|
|
|
showmessage('<27><>ǰҵ<C7B0><D2B5><EFBFBD><EFBFBD>״̬Ϊ:'+t_ch_precost.FieldByName('<27><><EFBFBD><EFBFBD>״̬').asstring+'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ļ<DEB8>ɾ<EFBFBD><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
|
|
|
|
exit;
|
|
|
|
|
end;
|
|
|
|
|
t_ch_precost.Delete;
|
|
|
|
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure Tfrm_ch_precost.bsSkinButton3Click(Sender: TObject);
|
|
|
|
|
begin
|
|
|
|
|
table_cancel(t_ch_precost);
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure Tfrm_ch_precost.t_ch_precostBeforePost(DataSet: TDataSet);
|
|
|
|
|
begin
|
|
|
|
|
table_before_post(t_ch_precost,'<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>');
|
|
|
|
|
|
|
|
|
|
if (t_ch_precost.state=dsinsert) and (trim(t_ch_precost.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString)='') then
|
|
|
|
|
begin
|
|
|
|
|
t_ch_precost['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=get_no(date,'PC');
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure Tfrm_ch_precost.t_ch_precostBeforeEdit(DataSet: TDataSet);
|
|
|
|
|
begin
|
|
|
|
|
if not modify_all then
|
|
|
|
|
begin
|
|
|
|
|
if (t_ch_precost.FieldByName('<27><><EFBFBD><EFBFBD>״̬').asstring='<27><><EFBFBD><EFBFBD>ƾ֤')then
|
|
|
|
|
begin
|
|
|
|
|
showmessage(t_ch_precost.FieldByName('<27><><EFBFBD><EFBFBD>״̬').asstring+'״̬<D7B4><CCAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
|
|
|
|
abort;
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure Tfrm_ch_precost.FormCloseQuery(Sender: TObject;
|
|
|
|
|
var CanClose: Boolean);
|
|
|
|
|
begin
|
|
|
|
|
CanClose:=frm_close_query(t_ch_precost);
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure Tfrm_ch_precost.bsSkinButton9Click(Sender: TObject);
|
|
|
|
|
var
|
|
|
|
|
Pnt:Tpoint;
|
|
|
|
|
begin
|
|
|
|
|
Pnt:=bsSkinButton9.ClientToScreen(Point(0,bsSkinButton9.Height));
|
|
|
|
|
PopupMenu1.Popup(Pnt.x,Pnt.y);
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure Tfrm_ch_precost.bsSkinButton5Click(Sender: TObject);
|
|
|
|
|
begin
|
|
|
|
|
close;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure Tfrm_ch_precost.N16Click(Sender: TObject);
|
|
|
|
|
begin
|
|
|
|
|
grid_save_xls(dxdbgrid3);
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure Tfrm_ch_precost.bsSkinPanel2Resize(Sender: TObject);
|
|
|
|
|
var
|
|
|
|
|
i:integer;
|
|
|
|
|
begin
|
|
|
|
|
i:=round(bsSkinPanel2.Width/10);
|
|
|
|
|
bsSkinButton10.Width:=i;
|
|
|
|
|
bsSkinButton9.Width:=i;
|
|
|
|
|
bsSkinButton2.Width:=i;
|
|
|
|
|
bsSkinButton3.Width:=i;
|
|
|
|
|
bsSkinButton4.Width:=i;
|
|
|
|
|
bsSkinButton1.Width:=i;
|
|
|
|
|
bsSkinButton11.Width:=i;
|
|
|
|
|
bsSkinButton6.Width:=i;
|
|
|
|
|
bsSkinButton38.Width:=i;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure Tfrm_ch_precost.bsSkinButton38Click(Sender: TObject);
|
|
|
|
|
var
|
|
|
|
|
book1:Tbookmark;
|
|
|
|
|
begin
|
|
|
|
|
if t_ch_precost.IsEmpty then
|
|
|
|
|
exit;
|
|
|
|
|
if bsSkinNotebook1.PageIndex=0 then
|
|
|
|
|
begin
|
|
|
|
|
book1:=t_ch_precost.GetBookmark;
|
|
|
|
|
t_ch_precost.Requery;
|
|
|
|
|
t_ch_precost.GotoBookmark(book1);
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
begin
|
|
|
|
|
book1:=t_ch_precost.GetBookmark;
|
|
|
|
|
t_ch_precost.Refresh;
|
|
|
|
|
t_ch_precost.GotoBookmark(book1);
|
|
|
|
|
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure Tfrm_ch_precost.DBEdit12Change(Sender: TObject);
|
|
|
|
|
begin
|
|
|
|
|
bsSkinButton6.Caption:='<27>ύ<EFBFBD><E1BDBB><EFBFBD><EFBFBD>';
|
|
|
|
|
if t_ch_precost.State in [dsinsert] then exit;
|
|
|
|
|
if t_ch_precost.IsEmpty then exit;
|
|
|
|
|
if t_ch_precost.FieldByName('<27><><EFBFBD><EFBFBD>״̬').AsString='<27>ύ<EFBFBD><E1BDBB><EFBFBD><EFBFBD>' then begin
|
|
|
|
|
bsSkinButton6.Caption:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
|
|
|
|
|
end else begin
|
|
|
|
|
bsSkinButton6.Caption:='<27>ύ<EFBFBD><E1BDBB><EFBFBD><EFBFBD>';
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure Tfrm_ch_precost.bsSkinButton8Click(Sender: TObject);
|
|
|
|
|
begin
|
|
|
|
|
RxDBLookupCombo5.ClearValue;
|
|
|
|
|
Edit4.text:='';
|
|
|
|
|
Edit2.text:='';
|
|
|
|
|
wwDBDateTimePicker1.Clear;
|
|
|
|
|
wwDBDateTimePicker2.clear;
|
|
|
|
|
RxDBLookupCombo16.ClearValue;
|
|
|
|
|
end;
|
|
|
|
|
procedure Tfrm_ch_precost.UpdateBillAmt;
|
|
|
|
|
var aAdoQuery:TAdoQuery;
|
|
|
|
|
amt:Double;
|
|
|
|
|
begin
|
|
|
|
|
aAdoQuery:=CreateAdoQuery;
|
|
|
|
|
with aAdoQuery do
|
|
|
|
|
try
|
|
|
|
|
close;
|
|
|
|
|
SQL.clear;
|
|
|
|
|
sql.add('select ');
|
|
|
|
|
sql.Add('sum(case when <20>ұ<EFBFBD>=''RMB'' then <20><><EFBFBD><EFBFBD> else 0 end) as <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
|
|
|
|
sql.Add(',sum(case when <20>ұ<EFBFBD><>''RMB'' then <20><><EFBFBD><EFBFBD> else 0 end) as <20><><EFBFBD><EFBFBD>');
|
|
|
|
|
sql.Add('from t_ch_fee_do_precost ');
|
|
|
|
|
sql.Add('where <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>=:<3A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ');
|
|
|
|
|
Parameters.ParamByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').Value:=t_ch_precost.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString;
|
|
|
|
|
Open;First;
|
|
|
|
|
if not IsEmpty then
|
|
|
|
|
begin
|
|
|
|
|
t_ch_precost.Edit;
|
|
|
|
|
t_ch_precost.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD>ҽ<EFBFBD><D2BD><EFBFBD>').value:=FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').value;
|
|
|
|
|
t_ch_precost.FieldByName('<27><>Ԫ<EFBFBD><D4AA><EFBFBD><EFBFBD>').value:=FieldByName('<27><><EFBFBD><EFBFBD>').value;
|
|
|
|
|
t_ch_precost.Post;
|
|
|
|
|
end;
|
|
|
|
|
finally
|
|
|
|
|
Free;
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure Tfrm_ch_precost.bsSkinButton7Click(Sender: TObject);
|
|
|
|
|
var
|
|
|
|
|
str_fee,str_op,str_zhfee,str_zhop:widestring;
|
|
|
|
|
Str:String;
|
|
|
|
|
aAdoQuery:TAdoQuery;
|
|
|
|
|
begin
|
|
|
|
|
aAdoQuery:=CreateAdoQuery;
|
|
|
|
|
with aAdoQuery do
|
|
|
|
|
try
|
|
|
|
|
memtblItems.Close;
|
|
|
|
|
memtblItems.Open;
|
|
|
|
|
memtblItems.EmptyTable;
|
|
|
|
|
memtblItems.DisableControls;
|
|
|
|
|
Close;SQL.Clear;
|
|
|
|
|
SQL.Add('select v_op_bscard_All.<2E><><EFBFBD><EFBFBD>, v_op_bscard_All.<2E><><EFBFBD>ᵥ<EFBFBD><E1B5A5>, v_op_bscard_All.ί<>б<EFBFBD><D0B1><EFBFBD>, v_op_bscard_All.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
|
|
|
|
SQL.Add(',t_ch_fee.ch_id,t_ch_fee.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>,t_ch_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,t_ch_fee.<2E><><EFBFBD><EFBFBD>,t_ch_fee.<2E>ұ<EFBFBD>,t_ch_fee.<2E><><EFBFBD><EFBFBD>');
|
|
|
|
|
SQL.Add('from V_op_bscard_All');
|
|
|
|
|
SQL.Add('left join t_ch_fee on t_ch_fee.<2E><><EFBFBD><EFBFBD> = v_op_bscard_All.<2E><><EFBFBD><EFBFBD>');
|
|
|
|
|
SQL.Add('where t_ch_fee.<2E><><EFBFBD><EFBFBD>=''<27><>'' and isnull(t_ch_fee.<2E><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD>+t_ch_fee.<2E><><EFBFBD>뿪Ʊ,0)=0 and isnull(Ԥ<><D4A4><EFBFBD>ɱ<EFBFBD>,0)=0');
|
|
|
|
|
|
|
|
|
|
if ComboBox1.ItemIndex=0 then
|
|
|
|
|
SQL.Add(' and V_op_bscard_All.<2E><><EFBFBD><EFBFBD>״̬=''<27><><EFBFBD>÷<EFBFBD><C3B7><EFBFBD>'' ');
|
|
|
|
|
|
|
|
|
|
if ComboBox2.ItemIndex=0 then
|
|
|
|
|
SQL.Add(' and V_op_bscard_All.<2E><><EFBFBD><EFBFBD> in (select distinct <20><><EFBFBD><EFBFBD> from t_ch_fee where isnull(<28><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD>+<2B><><EFBFBD>뿪Ʊ,0)<>0 and <20><><EFBFBD><EFBFBD>=''<27><>'')')
|
|
|
|
|
else
|
|
|
|
|
if ComboBox2.ItemIndex=1 then
|
|
|
|
|
begin
|
|
|
|
|
SQL.Add(' and V_op_bscard_All.<2E><><EFBFBD><EFBFBD> in (select distinct <20><><EFBFBD><EFBFBD> from t_ch_fee where isnull(<28><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD>+<2B><><EFBFBD>뿪Ʊ,0)<>0 and <20><><EFBFBD><EFBFBD>=''<27><>'')');
|
|
|
|
|
SQL.Add(' and V_op_bscard_All.<2E><><EFBFBD><EFBFBD> in (select distinct <20><><EFBFBD><EFBFBD> from t_ch_fee where isnull(<28><><EFBFBD><EFBFBD>-<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,0)<>0 and <20><><EFBFBD><EFBFBD>=''<27><>'')');
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
if RxDBLookupCombo5.DisplayValues[1]<>'' then
|
|
|
|
|
SQL.Add(' and t_ch_fee.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>='''+RxDBLookupCombo5.DisplayValues[1]+'''');
|
|
|
|
|
if Edit4.text<>''then
|
|
|
|
|
SQL.Add(' and v_op_bscard_All.ί<>б<EFBFBD><D0B1><EFBFBD> like '''+'%'+Edit4.text+'%''');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if Edit2.text<>''then
|
|
|
|
|
SQL.Add(' and v_op_bscard_All.<2E><><EFBFBD>ᵥ<EFBFBD><E1B5A5> like '''+'%'+Edit2.text+'%''');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if Edit16.text<>''then
|
|
|
|
|
SQL.Add(' and (v_op_bscard_All.<2E><><EFBFBD>ᵥ<EFBFBD><E1B5A5> like '''+'%'+Edit2.text+'%'' or ί<>б<EFBFBD><D0B1><EFBFBD> like '''+'%'+Edit4.text+'%'' )');
|
|
|
|
|
|
|
|
|
|
if wwDBDateTimePicker1.text<>''then
|
|
|
|
|
SQL.Add(' and v_op_bscard_All.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>>='''+wwDBDateTimePicker1.text+'''');
|
|
|
|
|
|
|
|
|
|
if wwDBDateTimePicker2.text<>''then
|
|
|
|
|
SQL.Add(' and v_op_bscard_All.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><='''+wwDBDateTimePicker2.text+'''');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if RxDBLookupCombo16.DisplayValues[1]<>'' then
|
|
|
|
|
if wwDBComboBox42.Text<>'' then
|
|
|
|
|
begin
|
|
|
|
|
if wwDBComboBox42.Text='<27><><EFBFBD><EFBFBD>' then
|
|
|
|
|
SQL.Add(' and t_ch_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>='''+RxDBLookupCombo16.DisplayValues[1]+'''')
|
|
|
|
|
else
|
|
|
|
|
if wwDBComboBox42.Text='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then
|
|
|
|
|
SQL.Add(' and t_ch_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><>'''+RxDBLookupCombo16.DisplayValues[1]+'''')
|
|
|
|
|
else
|
|
|
|
|
SQL.Add(' and t_ch_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> like '''+'%'+RxDBLookupCombo16.DisplayValues[1]+'%''');
|
|
|
|
|
end;
|
|
|
|
|
SQL.Add(' order by v_op_bscard_All.ί<>б<EFBFBD><D0B1><EFBFBD>');
|
|
|
|
|
Open;First;
|
|
|
|
|
while not eof do
|
|
|
|
|
begin
|
|
|
|
|
memtblItems.Insert;
|
|
|
|
|
memtblItems.FieldByName('CH_ID').AsInteger:=FieldByName('CH_ID').AsInteger;
|
|
|
|
|
memtblItems.FieldByName('ѡ<><D1A1>').AsBoolean:=false;
|
|
|
|
|
memtblItems.FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString:=FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString;
|
|
|
|
|
memtblItems.FieldByName('<27><><EFBFBD>ᵥ<EFBFBD><E1B5A5>').AsString:=FieldByName('<27><><EFBFBD>ᵥ<EFBFBD><E1B5A5>').AsString;
|
|
|
|
|
memtblItems.FieldByName('ί<>б<EFBFBD><D0B1><EFBFBD>').AsString:=FieldByName('ί<>б<EFBFBD><D0B1><EFBFBD>').AsString;
|
|
|
|
|
memtblItems.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString:=FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString;
|
|
|
|
|
memtblItems.FieldByName('<27>ұ<EFBFBD>').AsString:=FieldByName('<27>ұ<EFBFBD>').AsString;
|
|
|
|
|
memtblItems.FieldByName('<27><><EFBFBD><EFBFBD>').AsFloat:=s_w(2,FieldByName('<27><><EFBFBD><EFBFBD>').AsFloat);
|
|
|
|
|
// memtblItems.FieldByName('<27><><EFBFBD><EFBFBD>').AsFloat:=s_w(2,FieldByName('<27><><EFBFBD><EFBFBD>').AsFloat/1.06);
|
|
|
|
|
memtblItems.FieldByName('<27><>˰<EFBFBD><CBB0><EFBFBD><EFBFBD>').AsFloat:=FieldByName('<27><><EFBFBD><EFBFBD>').AsFloat;
|
|
|
|
|
memtblItems.FieldByName('<27><><EFBFBD><EFBFBD>').AsFloat:=FieldByName('<27><><EFBFBD><EFBFBD>').AsFloat;
|
|
|
|
|
memtblItems.FieldByName('<27><><EFBFBD><EFBFBD>').AsString:=FieldByName('<27><><EFBFBD><EFBFBD>').AsString;
|
|
|
|
|
memtblItems.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString:=FormatdateTime('YYYY-MM-DD',FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsDateTime);
|
|
|
|
|
memtblItems.Post;
|
|
|
|
|
Next;
|
|
|
|
|
end;
|
|
|
|
|
finally
|
|
|
|
|
memtblItems.EnableControls;
|
|
|
|
|
FreeAndNil(aAdoQuery);
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure Tfrm_ch_precost.bsSkinButton13Click(Sender: TObject);
|
|
|
|
|
var
|
|
|
|
|
book1:Tbookmark;
|
|
|
|
|
aAdoQuery:TAdoQuery;
|
|
|
|
|
|
|
|
|
|
begin
|
|
|
|
|
if memtblItems.IsEmpty then
|
|
|
|
|
exit;
|
|
|
|
|
try
|
|
|
|
|
book1:=memtblItems.GetBookmark;
|
|
|
|
|
memtblItems.DisableControls;
|
|
|
|
|
with memtblItems do
|
|
|
|
|
begin
|
|
|
|
|
First;
|
|
|
|
|
while not Eof do
|
|
|
|
|
begin
|
|
|
|
|
Edit;
|
|
|
|
|
memtblItems.FieldByName('ѡ<><D1A1>').AsBoolean:=true;
|
|
|
|
|
Post;
|
|
|
|
|
Next;
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
finally
|
|
|
|
|
memtblItems.EnableControls;
|
|
|
|
|
memtblItems.GotoBookmark(book1);
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure Tfrm_ch_precost.bsSkinButton14Click(Sender: TObject);
|
|
|
|
|
var
|
|
|
|
|
book1:Tbookmark;
|
|
|
|
|
begin
|
|
|
|
|
if memtblItems.IsEmpty then
|
|
|
|
|
exit;
|
|
|
|
|
try
|
|
|
|
|
book1:=memtblItems.GetBookmark;
|
|
|
|
|
memtblItems.DisableControls;
|
|
|
|
|
with memtblItems do
|
|
|
|
|
begin
|
|
|
|
|
First;
|
|
|
|
|
while not Eof do
|
|
|
|
|
begin
|
|
|
|
|
Edit;
|
|
|
|
|
memtblItems.FieldByName('ѡ<><D1A1>').AsBoolean:=False;
|
|
|
|
|
Post;
|
|
|
|
|
Next;
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
finally
|
|
|
|
|
memtblItems.EnableControls;
|
|
|
|
|
memtblItems.GotoBookmark(book1);
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
procedure Tfrm_ch_precost.bsSkinButton15Click(Sender: TObject);
|
|
|
|
|
var
|
|
|
|
|
aAdoQuery,bAdoQuery:TAdoQuery;
|
|
|
|
|
begin
|
|
|
|
|
if t_ch_precost=nil then
|
|
|
|
|
exit;
|
|
|
|
|
if (t_ch_precost.State=dsinsert)or(t_ch_precost.State=dsedit) then
|
|
|
|
|
t_ch_precost.post;
|
|
|
|
|
if memtblItems.IsEmpty then
|
|
|
|
|
exit;
|
|
|
|
|
|
|
|
|
|
if (t_ch_precost.FieldByName('<27><><EFBFBD><EFBFBD>״̬').asstring='<27><><EFBFBD><EFBFBD>ƾ֤') then
|
|
|
|
|
begin
|
|
|
|
|
showmessage('<27>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD><EFBFBD>ƾ֤<C6BE><D6A4><EFBFBD>ܼ<EFBFBD><DCBC><EFBFBD>');
|
|
|
|
|
exit;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
aAdoQuery:=CreateAdoQuery;
|
|
|
|
|
with aAdoQuery do
|
|
|
|
|
begin
|
|
|
|
|
Close;SQL.Clear;
|
|
|
|
|
SQL.Add('Insert into t_ch_fee_do_precost (<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,CH_ID ,<2C>ұ<EFBFBD>,<2C><><EFBFBD><EFBFBD> ,ԭʼ<D4AD><CABC><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD>)');
|
|
|
|
|
SQL.Add('values (:<3A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,:ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,:CH_ID ,:<3A>ұ<EFBFBD>,:<3A><><EFBFBD><EFBFBD> ,:ԭʼ<D4AD><CABC><EFBFBD><EFBFBD>,:<3A><><EFBFBD><EFBFBD>)');
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
bAdoQuery:=CreateAdoQuery;
|
|
|
|
|
with bAdoQuery do
|
|
|
|
|
begin
|
|
|
|
|
Close;SQL.Clear;
|
|
|
|
|
SQL.Add('update t_ch_fee');
|
|
|
|
|
SQL.Add('set Ԥ<><D4A4><EFBFBD>ɱ<EFBFBD>=:Ԥ<><D4A4><EFBFBD>ɱ<EFBFBD>');
|
|
|
|
|
SQL.Add('where Ch_id=:ch_id');
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
frm_main.db.BeginTrans;
|
|
|
|
|
memtblItems.DisableControls;
|
|
|
|
|
with memtblItems do
|
|
|
|
|
begin
|
|
|
|
|
First;
|
|
|
|
|
while not Eof do
|
|
|
|
|
begin
|
|
|
|
|
if (FieldByName('ѡ<><D1A1>').AsBoolean) and (t_ch_precost.FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString=FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString) then
|
|
|
|
|
begin
|
|
|
|
|
aAdoQuery.Close;
|
|
|
|
|
aAdoQuery.Parameters.ParamByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').Value:=t_ch_precost.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString;
|
|
|
|
|
aAdoQuery.Parameters.ParamByName('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').Value:=FieldByName('<27><><EFBFBD><EFBFBD>').AsString;
|
|
|
|
|
aAdoQuery.Parameters.ParamByName('CH_ID').Value:=FieldByName('CH_ID').AsInteger;
|
|
|
|
|
aAdoQuery.Parameters.ParamByName('<27>ұ<EFBFBD>').Value:=FieldByName('<27>ұ<EFBFBD>').AsString;
|
|
|
|
|
aAdoQuery.Parameters.ParamByName('<27><><EFBFBD><EFBFBD>').Value:=FieldByName('<27><><EFBFBD><EFBFBD>').AsFloat;
|
|
|
|
|
aAdoQuery.Parameters.ParamByName('ԭʼ<D4AD><CABC><EFBFBD><EFBFBD>').Value:=FieldByName('<27><><EFBFBD><EFBFBD>').AsFloat;
|
|
|
|
|
aAdoQuery.Parameters.ParamByName('<27><><EFBFBD><EFBFBD>').Value:='1';
|
|
|
|
|
aAdoQuery.ExecSQL;
|
|
|
|
|
|
|
|
|
|
bAdoQuery.Close;
|
|
|
|
|
bAdoQuery.Parameters.ParamByName('CH_ID').Value:=FieldByName('CH_ID').AsInteger;
|
|
|
|
|
bAdoQuery.Parameters.ParamByName('Ԥ<><D4A4><EFBFBD>ɱ<EFBFBD>').Value:=FieldByName('<27><><EFBFBD><EFBFBD>').AsFloat;
|
|
|
|
|
bAdoQuery.ExecSQL;
|
|
|
|
|
end;
|
|
|
|
|
Next;
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
UpdateBillAmt;
|
|
|
|
|
frm_main.db.CommitTrans;
|
|
|
|
|
finally
|
|
|
|
|
if frm_main.db.InTransaction then
|
|
|
|
|
begin
|
|
|
|
|
frm_main.db.RollbackTrans;
|
|
|
|
|
end;
|
|
|
|
|
memtblItems.EnableControls;
|
|
|
|
|
FreeAndNil(aAdoQuery);
|
|
|
|
|
FreeAndNil(bAdoQuery);
|
|
|
|
|
t_ch_fee_do_precost.Requery;
|
|
|
|
|
bsSkinButton7Click(Sender);
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure Tfrm_ch_precost.dxDBGrid3SelectedCountChange(Sender: TObject);
|
|
|
|
|
var
|
|
|
|
|
i,k:integer;
|
|
|
|
|
DR,CR,USDDR,USDCR,NDR,NCR,NUSDDR,NUSDCR,OTDR,OTCR,NOTDR,NOTCR:Double;
|
|
|
|
|
aFieldName:string;
|
|
|
|
|
begin
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
aFieldName:='<27><><EFBFBD><EFBFBD>';
|
|
|
|
|
DR:=0;
|
|
|
|
|
CR:=0;
|
|
|
|
|
USDDR:=0;
|
|
|
|
|
USDCR:=0;
|
|
|
|
|
NDR:=0;
|
|
|
|
|
NCR:=0;
|
|
|
|
|
NUSDDR:=0;
|
|
|
|
|
NUSDCR:=0;
|
|
|
|
|
OTDR:=0;
|
|
|
|
|
OTCR:=0;
|
|
|
|
|
NOTDR:=0;
|
|
|
|
|
NOTCR:=0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if memtblItems.IsEmpty then
|
|
|
|
|
exit;
|
|
|
|
|
if dxDBGrid3.SelectedCount>=1 then
|
|
|
|
|
begin
|
|
|
|
|
for i:=0 to dxDBGrid3.SelectedCount-1 do
|
|
|
|
|
begin
|
|
|
|
|
memtblItems.GotoBookmark(pointer(dxDBGrid3.selectedrows[i]));
|
|
|
|
|
if memtblItems.FieldByName('<27>ұ<EFBFBD>').AsString='USD' then
|
|
|
|
|
begin
|
|
|
|
|
USDCR:=USDCR+memtblItems.fieldByName(aFieldName).AsFloat;
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
begin
|
|
|
|
|
CR:=CR+memtblItems.fieldByName(aFieldName).AsFloat;
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
begin
|
|
|
|
|
memtblItems.GotoBookmark(pointer(dxDBGrid3.selectedrows[i]));
|
|
|
|
|
if memtblItems.FieldByName('<27>ұ<EFBFBD>').AsString='USD' then
|
|
|
|
|
begin
|
|
|
|
|
USDCR:=USDCR+memtblItems.fieldByName(aFieldName).AsFloat;
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
begin
|
|
|
|
|
CR:=CR+memtblItems.fieldByName(aFieldName).AsFloat;
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
bsSkinLabel1.Caption:='<27><>ѡ<EFBFBD><D1A1> USD:'+FormatFloat('#,##,0.00;-0.00',USDCR)+',RMB:'+FormatFloat('#,##,0.00;-0.00',CR);
|
|
|
|
|
}
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure Tfrm_ch_precost.bsSkinButton16Click(Sender: TObject);
|
|
|
|
|
var
|
|
|
|
|
i:integer;
|
|
|
|
|
aAdoQuery,bAdoQuery,cAdoQuery:TAdoQuery;
|
|
|
|
|
begin
|
|
|
|
|
if t_ch_fee_do_precost.IsEmpty then
|
|
|
|
|
exit;
|
|
|
|
|
|
|
|
|
|
if (t_ch_precost.FieldByName('<27><><EFBFBD><EFBFBD>״̬').asstring='<27><><EFBFBD><EFBFBD>ƾ֤') then
|
|
|
|
|
begin
|
|
|
|
|
showmessage('<27><>ǰҵ<C7B0><D2B5><EFBFBD><EFBFBD>״̬Ϊ:'+t_ch_precost.FieldByName('<27><><EFBFBD><EFBFBD>״̬').asstring+'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ļ<DEB8>ɾ<EFBFBD><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
|
|
|
|
exit;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
aAdoQuery:=CreateAdoQuery;
|
|
|
|
|
with aAdoQuery do
|
|
|
|
|
begin
|
|
|
|
|
Close;SQL.Clear;
|
|
|
|
|
SQL.Add('delete from t_ch_fee_do_precost');
|
|
|
|
|
SQL.Add('where DO_ID=:DO_ID');
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bAdoQuery:=CreateAdoQuery;
|
|
|
|
|
with bAdoQuery do
|
|
|
|
|
begin
|
|
|
|
|
Close;SQL.Clear;
|
|
|
|
|
SQL.Add('update t_ch_fee');
|
|
|
|
|
SQL.Add('set Ԥ<><D4A4><EFBFBD>ɱ<EFBFBD>=Ԥ<><D4A4><EFBFBD>ɱ<EFBFBD>-:Ԥ<><D4A4><EFBFBD>ɱ<EFBFBD>');
|
|
|
|
|
SQL.Add('where Ch_id=:ch_id');
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
cAdoQuery:=CreateAdoQuery;
|
|
|
|
|
with cAdoQuery do
|
|
|
|
|
begin
|
|
|
|
|
Close;SQL.Clear;
|
|
|
|
|
SQL.Add('select <20><><EFBFBD>ֳɱ<D6B3> from t_ch_fee');
|
|
|
|
|
SQL.Add('where Ch_id=:ch_id ');
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
frm_main.db.BeginTrans;
|
|
|
|
|
if dxDBGrid2.SelectedCount>=1 then
|
|
|
|
|
begin
|
|
|
|
|
for i:=0 to dxDBGrid2.SelectedCount-1 do
|
|
|
|
|
begin
|
|
|
|
|
t_ch_fee_do_precost.GotoBookmark(pointer(dxDBGrid2.selectedrows[i]));
|
|
|
|
|
|
|
|
|
|
cAdoQuery.Close;
|
|
|
|
|
cAdoQuery.Parameters.ParamByName('CH_ID').Value:=t_ch_fee_do_precost.FieldByName('CH_ID').AsInteger;
|
|
|
|
|
cAdoQuery.Open;
|
|
|
|
|
if cAdoQuery.FieldByName('<27><><EFBFBD>ֳɱ<D6B3>').AsFloat=0 then
|
|
|
|
|
begin
|
|
|
|
|
|
|
|
|
|
aAdoQuery.Close;
|
|
|
|
|
aAdoQuery.Parameters.ParamByName('DO_ID').Value:=t_ch_fee_do_precost.FieldByName('DO_ID').AsInteger;
|
|
|
|
|
aAdoQuery.ExecSQL;
|
|
|
|
|
bAdoQuery.Close;
|
|
|
|
|
bAdoQuery.Parameters.ParamByName('CH_ID').Value:=t_ch_fee_do_precost.FieldByName('CH_ID').AsInteger;
|
|
|
|
|
bAdoQuery.Parameters.ParamByName('Ԥ<><D4A4><EFBFBD>ɱ<EFBFBD>').Value:=t_ch_fee_do_precost.FieldByName('<27><><EFBFBD><EFBFBD>').AsFloat;
|
|
|
|
|
bAdoQuery.ExecSQL;
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
begin
|
|
|
|
|
ShowMessage('<27>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD>ֳɱ<D6B3> <20><><EFBFBD><EFBFBD>ȡ<EFBFBD><C8A1>');
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
begin
|
|
|
|
|
cAdoQuery.Close;
|
|
|
|
|
cAdoQuery.Parameters.ParamByName('CH_ID').Value:=t_ch_fee_do_precost.FieldByName('CH_ID').AsInteger;
|
|
|
|
|
cAdoQuery.Open;
|
|
|
|
|
if cAdoQuery.FieldByName('<27><><EFBFBD>ֳɱ<D6B3>').AsFloat=0 then
|
|
|
|
|
begin
|
|
|
|
|
|
|
|
|
|
aAdoQuery.Close;
|
|
|
|
|
aAdoQuery.Parameters.ParamByName('DO_ID').Value:=t_ch_fee_do_precost.FieldByName('DO_ID').AsInteger;
|
|
|
|
|
aAdoQuery.ExecSQL;
|
|
|
|
|
bAdoQuery.Close;
|
|
|
|
|
bAdoQuery.Parameters.ParamByName('CH_ID').Value:=t_ch_fee_do_precost.FieldByName('CH_ID').AsInteger;
|
|
|
|
|
bAdoQuery.Parameters.ParamByName('Ԥ<><D4A4><EFBFBD>ɱ<EFBFBD>').Value:=t_ch_fee_do_precost.FieldByName('<27><><EFBFBD><EFBFBD>').AsFloat;
|
|
|
|
|
bAdoQuery.ExecSQL;
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
begin
|
|
|
|
|
ShowMessage('<27>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD>ֳɱ<D6B3> <20><><EFBFBD><EFBFBD>ȡ<EFBFBD><C8A1>');
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
UpdateBillAmt;
|
|
|
|
|
frm_main.db.CommitTrans;
|
|
|
|
|
finally
|
|
|
|
|
if frm_main.db.InTransaction then
|
|
|
|
|
begin
|
|
|
|
|
frm_main.db.RollbackTrans;
|
|
|
|
|
end;
|
|
|
|
|
FreeAndNil(aAdoQuery);
|
|
|
|
|
FreeAndNil(bAdoQuery);
|
|
|
|
|
FreeAndNil(cAdoQuery);
|
|
|
|
|
t_ch_fee_do_precost.Requery;
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure Tfrm_ch_precost.bsSkinButton17Click(Sender: TObject);
|
|
|
|
|
begin
|
|
|
|
|
if t_ch_precost=nil then
|
|
|
|
|
exit;
|
|
|
|
|
if (t_ch_precost.State=dsinsert)or(t_ch_precost.State=dsedit) then
|
|
|
|
|
t_ch_precost.post;
|
|
|
|
|
if t_ch_fee_do_precost.IsEmpty then
|
|
|
|
|
exit;
|
|
|
|
|
|
|
|
|
|
if (t_ch_precost.FieldByName('<27><><EFBFBD><EFBFBD>״̬').asstring='<27><><EFBFBD><EFBFBD>ƾ֤') then
|
|
|
|
|
begin
|
|
|
|
|
showmessage('<27>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD><EFBFBD>ƾ֤');
|
|
|
|
|
exit;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
NewDCVou_One;
|
|
|
|
|
t_ch_precost.Refresh;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure Tfrm_ch_precost.dxdbgrid1Column2CustomDraw(Sender: TObject;
|
|
|
|
|
ACanvas: TCanvas; ARect: TRect; ANode: TdxTreeListNode;
|
|
|
|
|
AColumn: TdxDBTreeListColumn; const AText: String; AFont: TFont;
|
|
|
|
|
var AColor: TColor; ASelected, AFocused: Boolean; var ADone: Boolean);
|
|
|
|
|
begin
|
|
|
|
|
if (ANode.strings[dxDBGrid1Column2.Index]='¼<><C2BC>״̬') then
|
|
|
|
|
AColor :=clwhite
|
|
|
|
|
else if (ANode.strings[dxDBGrid1Column2.Index]='<27><><EFBFBD><EFBFBD>ƾ֤') then
|
|
|
|
|
AColor :=$00DDF21C;
|
|
|
|
|
|
|
|
|
|
AFont.Color:=clblack;
|
|
|
|
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure Tfrm_ch_precost.DBEdit9Change(Sender: TObject);
|
|
|
|
|
begin
|
|
|
|
|
if t_ch_precost.FieldByName('<27><><EFBFBD><EFBFBD>״̬').asstring='<27><><EFBFBD><EFBFBD>ƾ֤' then
|
|
|
|
|
DBEdit9.Color :=$00DDF21C
|
|
|
|
|
else DBEdit9.Color :=clwhite;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure Tfrm_ch_precost.dxDBGrid3CustomDraw(Sender: TObject;
|
|
|
|
|
ACanvas: TCanvas; ARect: TRect; ANode: TdxTreeListNode;
|
|
|
|
|
AColumn: TdxDBTreeListColumn; const AText: String; AFont: TFont;
|
|
|
|
|
var AColor: TColor; ASelected, AFocused: Boolean; var ADone: Boolean);
|
|
|
|
|
begin
|
|
|
|
|
if uppercase(ANode.Strings[dxDBGrid3Column8.Index])='TRUE' then
|
|
|
|
|
begin
|
|
|
|
|
AColor:=clSkyBlue;
|
|
|
|
|
exit;
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure Tfrm_ch_precost.dxDBGrid3DblClick(Sender: TObject);
|
|
|
|
|
begin
|
|
|
|
|
fee_view(memtblItems.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring);
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
end.
|
|
|
|
|
|