You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

8062 lines
310 KiB
Plaintext

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

unit u_cw_pingzheng_gj;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, bsSkinCtrls, ComCtrls, bsSkinTabs, dxExEdtr, dxCntner, dxTL,
dxDBCtrl, dxDBGrid, StdCtrls, wwdbdatetimepicker, RxLookup, DB, ADODB,FileCtrl,
dxDBTLCl, dxGrClms, Mask, wwdbedit, Wwdotdot, Wwdbcomb, Grids, DBGrids,
ExtCtrls, DBGridEh, kbmMemTable, DBTables, wwdblook, DBCtrls, cxStyles,
cxCustomData, cxGraphics, cxFilter, cxData, cxDataStorage, cxEdit,
cxDBData, cxGridCustomTableView, cxGridTableView, cxGridDBTableView,
cxGridLevel, cxClasses, cxControls, cxGridCustomView, cxGrid;
type
Tfrm_cw_pingzheng_gj = class(TForm)
t_op_seae: TADOQuery;
t_op_seae1: TDataSource;
t_cw_design: TADOQuery;
t_cw_design1: TDataSource;
t_op_seai: TADOQuery;
t_op_seai1: TDataSource;
t_op_airi1: TDataSource;
t_op_airi: TADOQuery;
t_op_aire: TADOQuery;
t_op_aire1: TDataSource;
t_ch_invoice: TADOQuery;
t_ch_invoice1: TDataSource;
bsSkinPanel2: TbsSkinPanel;
bsSkinPageControl2: TbsSkinPageControl;
tbbsVou: TbsSkinTabSheet;
tbbalvou: TbsSkinTabSheet;
bsSkinGroupBox2: TbsSkinGroupBox;
bsSkinPanel10: TbsSkinPanel;
Label25: TLabel;
Label65: TLabel;
Label26: TLabel;
Label27: TLabel;
Label28: TLabel;
Edit9: TEdit;
wwDBDateTimePicker17: TwwDBDateTimePicker;
wwDBDateTimePicker18: TwwDBDateTimePicker;
wwDBComboBox1: TwwDBComboBox;
bsSkinPageControl1: TbsSkinPageControl;
bsSkinTabSheet1: TbsSkinTabSheet;
bsSkinPanel1: TbsSkinPanel;
Label10: TLabel;
Label3: TLabel;
Label5: TLabel;
Label8: TLabel;
Label11: TLabel;
wwDBDateTimePicker1: TwwDBDateTimePicker;
Edit4: TEdit;
wwDBDateTimePicker2: TwwDBDateTimePicker;
Edit2: TEdit;
wwDBDateTimePicker3: TwwDBDateTimePicker;
wwDBDateTimePicker4: TwwDBDateTimePicker;
bsSkinTabSheet2: TbsSkinTabSheet;
bsSkinPanel4: TbsSkinPanel;
Label2: TLabel;
Label4: TLabel;
Label6: TLabel;
Label7: TLabel;
Label9: TLabel;
Label12: TLabel;
wwDBDateTimePicker5: TwwDBDateTimePicker;
Edit1: TEdit;
wwDBDateTimePicker6: TwwDBDateTimePicker;
Edit3: TEdit;
wwDBDateTimePicker7: TwwDBDateTimePicker;
wwDBDateTimePicker8: TwwDBDateTimePicker;
bsSkinTabSheet3: TbsSkinTabSheet;
bsSkinPanel6: TbsSkinPanel;
Label13: TLabel;
Label14: TLabel;
Label15: TLabel;
Label16: TLabel;
Label17: TLabel;
Label18: TLabel;
wwDBDateTimePicker9: TwwDBDateTimePicker;
Edit5: TEdit;
wwDBDateTimePicker10: TwwDBDateTimePicker;
Edit6: TEdit;
wwDBDateTimePicker11: TwwDBDateTimePicker;
wwDBDateTimePicker12: TwwDBDateTimePicker;
bsSkinTabSheet4: TbsSkinTabSheet;
bsSkinPanel8: TbsSkinPanel;
Label19: TLabel;
Label20: TLabel;
Label21: TLabel;
Label22: TLabel;
Label23: TLabel;
Label24: TLabel;
wwDBDateTimePicker13: TwwDBDateTimePicker;
Edit7: TEdit;
wwDBDateTimePicker14: TwwDBDateTimePicker;
Edit8: TEdit;
wwDBDateTimePicker15: TwwDBDateTimePicker;
wwDBDateTimePicker16: TwwDBDateTimePicker;
bsSkinPanel12: TbsSkinPanel;
TBVouList: TbsSkinTabSheet;
bsSkinPanel16: TbsSkinPanel;
t_op_balance: TADOQuery;
t_op_balance1: TDataSource;
bsSkinButton5: TbsSkinButton;
t_op_balanceDSDesigner: TStringField;
t_op_balanceDSDesigner2: TStringField;
t_op_balanceDSDesigner3: TStringField;
t_op_balanceDSDesigner4: TStringField;
t_op_balanceDSDesigner5: TStringField;
t_op_balanceDSDesigner6: TStringField;
t_op_balanceDSDesigner7: TBCDField;
t_op_balanceDSDesigner8: TBCDField;
t_op_balanceDSDesigner9: TBCDField;
t_op_balanceDSDesigner10: TStringField;
t_op_balanceDSDesigner11: TStringField;
t_op_balanceDSDesigner12: TStringField;
t_op_balanceDSDesigner13: TDateTimeField;
t_op_balanceDSDesigner14: TBooleanField;
t_op_balanceDSDesigner15: TStringField;
t_op_balanceDSDesigner16: TStringField;
t_op_balanceDSDesigner17: TDateTimeField;
t_op_balanceDSDesigner18: TStringField;
t_op_balanceDSDesigner19: TStringField;
t_op_balanceDSDesigner20: TDateTimeField;
t_op_balanceDSDesigner21: TStringField;
t_op_balanceDSDesigner22: TBooleanField;
t_op_balanceDSDesigner23: TStringField;
bsSkinButton10: TbsSkinButton;
bsSkinButton3: TbsSkinButton;
bsSkinButton1: TbsSkinButton;
bsSkinButton4: TbsSkinButton;
bsSkinButton6: TbsSkinButton;
bsSkinButton7: TbsSkinButton;
bsSkinButton9: TbsSkinButton;
bsSkinButton11: TbsSkinButton;
bsSkinButton12: TbsSkinButton;
bsSkinButton14: TbsSkinButton;
bsSkinButton15: TbsSkinButton;
bsSkinButton16: TbsSkinButton;
bsSkinButton18: TbsSkinButton;
bsSkinButton19: TbsSkinButton;
bsSkinButton20: TbsSkinButton;
bsSkinCheckRadioBox1: TbsSkinCheckRadioBox;
bsSkinCheckRadioBox2: TbsSkinCheckRadioBox;
bsSkinCheckRadioBox3: TbsSkinCheckRadioBox;
bsSkinCheckRadioBox4: TbsSkinCheckRadioBox;
bsSkinCheckRadioBox5: TbsSkinCheckRadioBox;
bsSkinPanel3: TbsSkinPanel;
DatabaseVouitems: TDatabase;
Label30: TLabel;
wwDBDateTimePicker19: TwwDBDateTimePicker;
Label31: TLabel;
wwDBDateTimePicker20: TwwDBDateTimePicker;
Label33: TLabel;
EditMblNo: TEdit;
EditOrdNoTo: TEdit;
Label34: TLabel;
EditOrdNoFrm: TEdit;
Label35: TLabel;
bsSkinButton2: TbsSkinButton;
bsSkinButton8: TbsSkinButton;
bsSkinButton13: TbsSkinButton;
bsSkinPanel7: TbsSkinPanel;
Splitter1: TSplitter;
bsSkinPanel9: TbsSkinPanel;
DBGridEh2: TDBGridEh;
bsSkinPanel11: TbsSkinPanel;
DBGridCarriageSum: TDBGridEh;
dsrvouitems: TDataSource;
dsrVou: TDataSource;
memTblVou: TkbmMemTable;
qryVouitems: TADOQuery;
Query1: TQuery;
bsSkinCheckRadioBox6: TbsSkinCheckRadioBox;
RxDBLookupCombo2: TRxDBLookupCombo;
Label29: TLabel;
wwDBDateTimePicker21: TwwDBDateTimePicker;
Label36: TLabel;
RxDBLookupCombo6: TRxDBLookupCombo;
SaveDialog1: TSaveDialog;
bsSkinButton17: TbsSkinButton;
bsSkinButton21: TbsSkinButton;
bsSkinButton22: TbsSkinButton;
bsSkinButton23: TbsSkinButton;
bsSkinButton24: TbsSkinButton;
bsSkinButton25: TbsSkinButton;
Label37: TLabel;
Edit10: TEdit;
Label38: TLabel;
Edit11: TEdit;
Label39: TLabel;
RxDBLookupCombo4: TRxDBLookupCombo;
Label40: TLabel;
RxDBLookupCombo1: TRxDBLookupCombo;
Label1: TLabel;
Label41: TLabel;
RxDBLookupCombo3: TRxDBLookupCombo;
Label42: TLabel;
RxDBLookupCombo5: TRxDBLookupCombo;
Label32: TLabel;
RxDBLookupCombo7: TRxDBLookupCombo;
Label43: TLabel;
Edit12: TEdit;
Label44: TLabel;
RxDBLookupCombo8: TRxDBLookupCombo;
Label45: TLabel;
RxDBLookupCombo9: TRxDBLookupCombo;
Label46: TLabel;
RxDBLookupCombo10: TRxDBLookupCombo;
Edit13: TEdit;
Label47: TLabel;
Label48: TLabel;
RxDBLookupCombo11: TRxDBLookupCombo;
Label49: TLabel;
RxDBLookupCombo12: TRxDBLookupCombo;
Label50: TLabel;
RxDBLookupCombo13: TRxDBLookupCombo;
Edit14: TEdit;
Label51: TLabel;
Label52: TLabel;
RxDBLookupCombo14: TRxDBLookupCombo;
Label53: TLabel;
RxDBLookupCombo15: TRxDBLookupCombo;
Label54: TLabel;
RxDBLookupCombo16: TRxDBLookupCombo;
Edit15: TEdit;
Label55: TLabel;
Label56: TLabel;
Edit16: TEdit;
Label57: TLabel;
Edit17: TEdit;
Label58: TLabel;
Edit18: TEdit;
Label59: TLabel;
Edit19: TEdit;
Label60: TLabel;
Edit20: TEdit;
Label61: TLabel;
Edit21: TEdit;
Label62: TLabel;
Edit22: TEdit;
Label63: TLabel;
Edit23: TEdit;
bsSkinCheckRadioBox7: TbsSkinCheckRadioBox;
t_op_balanceDSDesigner24: TBCDField;
t_op_balanceDSDesigner25: TBCDField;
t_op_balanceDSDesigner26: TStringField;
t_op_balanceDSDesigner27: TStringField;
t_op_balanceDSDesigner28: TStringField;
SQLConnectionAcc: TADOConnection;
QryAcc: TADOQuery;
tblObj: TADOTable;
tblObjFClsID: TIntegerField;
tblObjFObjID: TWideStringField;
tblObjFObjName: TWideStringField;
tblObjFUnit: TWideStringField;
tblObjFDeleted: TBooleanField;
tblObjFCompanyID: TWideStringField;
tblObjFParentID: TWideStringField;
tblObjFLevel: TIntegerField;
tblObjFDetail: TBooleanField;
tblObjFFullPath: TWideStringField;
tblObjA1: TBooleanField;
tblObjA2: TBooleanField;
tblObjA3: TBooleanField;
tblObjA4: TBooleanField;
tblObjA5: TBooleanField;
tblObjA6: TBooleanField;
tblObjA7: TBooleanField;
tblObjA8: TBooleanField;
tblObjA9: TBooleanField;
tblObjA10: TBooleanField;
tblObjA11: TBooleanField;
tblObjA12: TBooleanField;
tblObjA13: TBooleanField;
tblVouitems: TTable;
bsSkinTabSheet5: TbsSkinTabSheet;
bsSkinPanel5: TbsSkinPanel;
Label64: TLabel;
Label66: TLabel;
Label67: TLabel;
Label70: TLabel;
Label73: TLabel;
Label75: TLabel;
Label76: TLabel;
wwDBDateTimePicker22: TwwDBDateTimePicker;
Edit24: TEdit;
wwDBDateTimePicker23: TwwDBDateTimePicker;
Edit25: TEdit;
bsSkinButton26: TbsSkinButton;
bsSkinButton28: TbsSkinButton;
bsSkinCheckRadioBox8: TbsSkinCheckRadioBox;
Edit26: TEdit;
Edit27: TEdit;
Edit28: TEdit;
bsSkinButton27: TbsSkinButton;
t_Accitems: TADOQuery;
t_op_balanceDSDesigner29: TStringField;
t_op_balanceDSDesigner30: TBCDField;
tab4: TbsSkinTabSheet;
bsSkinPanel13: TbsSkinPanel;
Label68: TLabel;
Label69: TLabel;
Label71: TLabel;
Label72: TLabel;
Label74: TLabel;
Label77: TLabel;
Label78: TLabel;
Label79: TLabel;
wwDBDateTimePicker24: TwwDBDateTimePicker;
wwDBDateTimePicker25: TwwDBDateTimePicker;
Edit29: TEdit;
Edit30: TEdit;
Edit31: TEdit;
bsSkinButton29: TbsSkinButton;
bsSkinCheckRadioBox9: TbsSkinCheckRadioBox;
RxDBLookupCombo17: TRxDBLookupCombo;
RxDBLookupCombo18: TRxDBLookupCombo;
Edit32: TEdit;
DBGridEh8: TDBGridEh;
v_vouitems: TADOQuery;
v_vouitems1: TDataSource;
Edit33: TEdit;
Label80: TLabel;
ADOConnection1: TADOConnection;
ADOQuery1: TADOQuery;
Label81: TLabel;
Label82: TLabel;
Edit34: TEdit;
wwDBLookupCombo49: TwwDBLookupCombo;
Label83: TLabel;
wwDBLookupCombo1: TwwDBLookupCombo;
Label84: TLabel;
Edit35: TEdit;
qryVouitemsORDNO: TIntegerField;
qryVouitemsITEMNO: TIntegerField;
qryVouitemsACCID: TStringField;
qryVouitemsPACCID: TStringField;
qryVouitemsACCNAME: TStringField;
qryVouitemsPROPERTY: TSmallintField;
qryVouitemsGRADE: TSmallintField;
qryVouitemsDC: TStringField;
qryVouitemsSUBLEGTYPE: TStringField;
qryVouitemsAMTDR: TFloatField;
qryVouitemsAMTCR: TFloatField;
qryVouitemsFCY: TStringField;
qryVouitemsFCYNO: TStringField;
qryVouitemsFCYEXRATE: TFloatField;
qryVouitemsFCYDR: TFloatField;
qryVouitemsFCYCR: TFloatField;
qryVouitemsQTY: TStringField;
qryVouitemsQTYSPECS: TStringField;
qryVouitemsQTYUNIT: TStringField;
qryVouitemsPRICEDR: TFloatField;
qryVouitemsPRICECR: TFloatField;
qryVouitemsQTYDR: TFloatField;
qryVouitemsQTYCR: TFloatField;
qryVouitemsEXPLAN: TStringField;
qryVouitemsVERIFYED: TStringField;
qryVouitemsVERIFYLASTBLC: TFloatField;
qryVouitemsDEPTACC: TStringField;
qryVouitemsEMPLACC: TStringField;
qryVouitemsCORPACC: TStringField;
qryVouitemsITEMACC: TStringField;
qryVouitemsDEPTID: TStringField;
qryVouitemsEMPLID: TStringField;
qryVouitemsPITEMID: TIntegerField;
qryVouitemsITEMID: TIntegerField;
qryVouitemsFIELD1: TStringField;
qryVouitemsFIELD2: TStringField;
qryVouitemsFIELD3: TStringField;
qryVouitemsFIELD4: TStringField;
qryVouitemsFIELD5: TStringField;
qryVouitemsFIELD6: TStringField;
qryVouitemsFIELD7: TStringField;
qryVouitemsCF: TSmallintField;
qryVouitemsCUSTBE: TStringField;
qryVouitemsCORPBF: TStringField;
qryVouitemsSTATUS: TSmallintField;
qryVouitemsBSNO: TStringField;
qryVouitemsMBLNO: TStringField;
qryVouitemsFSETTLCODE: TStringField;
qryVouitemsFSETTLENO: TStringField;
Panel1: TPanel;
qryVouitems_Sum: TADOQuery;
qryVouitems_Sum1: TDataSource;
DBGridEh9: TDBGridEh;
qryVouitemsSNAME: TStringField;
t_corps: TADOQuery;
qryVouitemsCORPID: TStringField;
t_corps1: TDataSource;
qryVouitemsCNAME: TStringField;
bsSkinButton30: TbsSkinButton;
bsSkinButton31: TbsSkinButton;
bsSkinButton32: TbsSkinButton;
bsSkinButton33: TbsSkinButton;
qryVouitemsACCIDLK: TStringField;
bsSkinButton34: TbsSkinButton;
dxDBGrid1: TdxDBGrid;
dxDBGrid1Column1: TdxDBGridColumn;
dxDBGrid1Column2: TdxDBGridColumn;
dxDBGrid1Column3: TdxDBGridColumn;
dxDBGrid1Column4: TdxDBGridColumn;
dxDBGrid1Column5: TdxDBGridColumn;
dxDBGrid1Column6: TdxDBGridColumn;
dxDBGrid1Column7: TdxDBGridColumn;
dxDBGrid1Column8: TdxDBGridColumn;
dxDBGrid1Column9: TdxDBGridColumn;
dxDBGrid1Column10: TdxDBGridColumn;
dxDBGrid1Column11: TdxDBGridColumn;
dxDBGrid1Column12: TdxDBGridColumn;
dxDBGrid1Column13: TdxDBGridColumn;
dxDBGrid1Column14: TdxDBGridColumn;
dxDBGrid1Column15: TdxDBGridColumn;
bsSkinTabSheet6: TbsSkinTabSheet;
bsSkinPanel14: TbsSkinPanel;
Label85: TLabel;
Label86: TLabel;
Label87: TLabel;
Label88: TLabel;
Label89: TLabel;
Label90: TLabel;
Label91: TLabel;
wwDBDateTimePicker26: TwwDBDateTimePicker;
Edit36: TEdit;
wwDBDateTimePicker27: TwwDBDateTimePicker;
Edit37: TEdit;
bsSkinButton35: TbsSkinButton;
bsSkinButton36: TbsSkinButton;
bsSkinCheckRadioBox10: TbsSkinCheckRadioBox;
Edit38: TEdit;
Edit39: TEdit;
Edit40: TEdit;
bsSkinButton37: TbsSkinButton;
dxDBGrid3: TdxDBGrid;
dxDBGridColumn1: TdxDBGridColumn;
dxDBGridColumn2: TdxDBGridColumn;
dxDBGridColumn3: TdxDBGridColumn;
dxDBGridColumn4: TdxDBGridColumn;
dxDBGridColumn5: TdxDBGridColumn;
dxDBGridColumn6: TdxDBGridColumn;
dxDBGridColumn7: TdxDBGridColumn;
dxDBGridColumn8: TdxDBGridColumn;
dxDBGridColumn9: TdxDBGridColumn;
dxDBGridColumn10: TdxDBGridColumn;
dxDBGridColumn11: TdxDBGridColumn;
dxDBGridColumn12: TdxDBGridColumn;
dxDBGridColumn13: TdxDBGridColumn;
dxDBGridColumn14: TdxDBGridColumn;
dxDBGridColumn15: TdxDBGridColumn;
t_ch_invoice_hexiao: TADOQuery;
t_ch_invoice_hexiao1: TDataSource;
dxDBGrid3Column16: TdxDBGridColumn;
dxDBGrid3Column17: TdxDBGridColumn;
Label92: TLabel;
Label93: TLabel;
wwDBDateTimePicker28: TwwDBDateTimePicker;
wwDBDateTimePicker29: TwwDBDateTimePicker;
Label94: TLabel;
Label95: TLabel;
wwDBDateTimePicker30: TwwDBDateTimePicker;
wwDBDateTimePicker31: TwwDBDateTimePicker;
Label96: TLabel;
Edit41: TEdit;
Label97: TLabel;
Edit42: TEdit;
dxDBGrid4: TdxDBGrid;
dxDBGrid4Column1: TdxDBGridColumn;
dxDBGrid4Column2: TdxDBGridColumn;
dxDBGrid4Column3: TdxDBGridColumn;
dxDBGrid4Column4: TdxDBGridColumn;
dxDBGrid4Column5: TdxDBGridColumn;
dxDBGrid4Column6: TdxDBGridColumn;
dxDBGrid4Column7: TdxDBGridColumn;
dxDBGrid4Column8: TdxDBGridColumn;
dxDBGrid4Column9: TdxDBGridColumn;
dxDBGrid4Column10: TdxDBGridColumn;
dxDBGrid4Column11: TdxDBGridColumn;
dxDBGrid4Column12: TdxDBGridColumn;
dxDBGrid4Column13: TdxDBGridColumn;
dxDBGrid4Column14: TdxDBGridColumn;
dxDBGrid4Column15: TdxDBGridColumn;
dxDBGrid4Column16: TdxDBGridColumn;
dxDBGrid4Column17: TdxDBGridColumn;
dxDBGrid4Column18: TdxDBGridColumn;
dxDBGrid4Column19: TdxDBGridColumn;
dxDBGrid4Column20: TdxDBGridColumn;
dxDBGrid4Column21: TdxDBGridColumn;
dxDBGrid4Column22: TdxDBGridColumn;
dxDBGrid4Column23: TdxDBGridColumn;
dxDBGrid5: TdxDBGrid;
dxDBGridColumn16: TdxDBGridColumn;
dxDBGridColumn17: TdxDBGridColumn;
dxDBGridColumn18: TdxDBGridColumn;
dxDBGridColumn19: TdxDBGridColumn;
dxDBGridColumn20: TdxDBGridColumn;
dxDBGridColumn21: TdxDBGridColumn;
dxDBGridColumn22: TdxDBGridColumn;
dxDBGridColumn23: TdxDBGridColumn;
dxDBGridColumn24: TdxDBGridColumn;
dxDBGridColumn25: TdxDBGridColumn;
dxDBGridColumn26: TdxDBGridColumn;
dxDBGridColumn27: TdxDBGridColumn;
dxDBGridColumn28: TdxDBGridColumn;
dxDBGridColumn29: TdxDBGridColumn;
dxDBGridColumn30: TdxDBGridColumn;
dxDBGridColumn31: TdxDBGridColumn;
dxDBGridColumn32: TdxDBGridColumn;
dxDBGridColumn33: TdxDBGridColumn;
dxDBGridColumn34: TdxDBGridColumn;
dxDBGridColumn35: TdxDBGridColumn;
dxDBGridColumn36: TdxDBGridColumn;
dxDBGridColumn37: TdxDBGridColumn;
dxDBGridColumn38: TdxDBGridColumn;
dxDBGrid6: TdxDBGrid;
dxDBGridColumn39: TdxDBGridColumn;
dxDBGridColumn40: TdxDBGridColumn;
dxDBGridColumn41: TdxDBGridColumn;
dxDBGridColumn42: TdxDBGridColumn;
dxDBGridColumn43: TdxDBGridColumn;
dxDBGridColumn44: TdxDBGridColumn;
dxDBGridColumn45: TdxDBGridColumn;
dxDBGridColumn46: TdxDBGridColumn;
dxDBGridColumn47: TdxDBGridColumn;
dxDBGridColumn48: TdxDBGridColumn;
dxDBGridColumn49: TdxDBGridColumn;
dxDBGridColumn50: TdxDBGridColumn;
dxDBGridColumn51: TdxDBGridColumn;
dxDBGridColumn52: TdxDBGridColumn;
dxDBGridColumn53: TdxDBGridColumn;
dxDBGridColumn54: TdxDBGridColumn;
dxDBGridColumn56: TdxDBGridColumn;
dxDBGridColumn60: TdxDBGridColumn;
dxDBGridColumn61: TdxDBGridColumn;
dxDBGrid6Column20: TdxDBGridColumn;
dxDBGrid6Column21: TdxDBGridColumn;
dxDBGrid7: TdxDBGrid;
dxDBGridColumn55: TdxDBGridColumn;
dxDBGridColumn57: TdxDBGridColumn;
dxDBGridColumn58: TdxDBGridColumn;
dxDBGridColumn59: TdxDBGridColumn;
dxDBGridColumn62: TdxDBGridColumn;
dxDBGridColumn63: TdxDBGridColumn;
dxDBGridColumn64: TdxDBGridColumn;
dxDBGridColumn65: TdxDBGridColumn;
dxDBGridColumn66: TdxDBGridColumn;
dxDBGridColumn67: TdxDBGridColumn;
dxDBGridColumn68: TdxDBGridColumn;
dxDBGridColumn69: TdxDBGridColumn;
dxDBGridColumn70: TdxDBGridColumn;
dxDBGridColumn71: TdxDBGridColumn;
dxDBGridColumn72: TdxDBGridColumn;
dxDBGridColumn73: TdxDBGridColumn;
dxDBGridColumn74: TdxDBGridColumn;
dxDBGridColumn75: TdxDBGridColumn;
dxDBGridColumn76: TdxDBGridColumn;
dxDBGridColumn77: TdxDBGridColumn;
dxDBGridColumn78: TdxDBGridColumn;
dxDBGrid8: TdxDBGrid;
t_op_balance_items: TADOQuery;
t_op_balance_items1: TDataSource;
dxDBGrid2: TdxDBGrid;
dxDBGridColumn105: TdxDBGridColumn;
dxDBGridColumn106: TdxDBGridColumn;
dxDBGridColumn107: TdxDBGridColumn;
dxDBGridColumn108: TdxDBGridColumn;
dxDBGridCheckColumn2: TdxDBGridCheckColumn;
dxDBGridColumn109: TdxDBGridColumn;
dxDBGridColumn110: TdxDBGridColumn;
dxDBGridColumn111: TdxDBGridColumn;
dxDBGridColumn112: TdxDBGridColumn;
dxDBGridColumn113: TdxDBGridColumn;
dxDBGridColumn114: TdxDBGridColumn;
dxDBGridColumn115: TdxDBGridColumn;
dxDBGridColumn116: TdxDBGridColumn;
dxDBGridColumn117: TdxDBGridColumn;
dxDBGridColumn118: TdxDBGridColumn;
dxDBGridColumn119: TdxDBGridColumn;
dxDBGridColumn120: TdxDBGridColumn;
dxDBGridColumn121: TdxDBGridColumn;
dxDBGridColumn122: TdxDBGridColumn;
dxDBGridColumn123: TdxDBGridColumn;
dxDBGridColumn124: TdxDBGridColumn;
dxDBGridColumn125: TdxDBGridColumn;
dxDBGridColumn126: TdxDBGridColumn;
dxDBGridColumn127: TdxDBGridColumn;
dxDBGridColumn128: TdxDBGridColumn;
dxDBGridColumn129: TdxDBGridColumn;
dxDBGridColumn130: TdxDBGridColumn;
dxDBGrid8Column1: TdxDBGridColumn;
dxDBGrid8Column2: TdxDBGridColumn;
dxDBGrid8Column3: TdxDBGridColumn;
dxDBGrid8Column4: TdxDBGridColumn;
dxDBGrid8Column5: TdxDBGridColumn;
Label98: TLabel;
Edit43: TEdit;
procedure FormShow(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure bsSkinPageControl1Change(Sender: TObject);
procedure bsSkinButton10Click(Sender: TObject);
procedure bsSkinButton3Click(Sender: TObject);
procedure bsSkinButton5Click(Sender: TObject);
procedure bsSkinButton4Click(Sender: TObject);
procedure bsSkinButton6Click(Sender: TObject);
procedure bsSkinButton7Click(Sender: TObject);
procedure bsSkinButton8Click(Sender: TObject);
procedure bsSkinButton9Click(Sender: TObject);
procedure bsSkinButton11Click(Sender: TObject);
procedure bsSkinButton14Click(Sender: TObject);
procedure bsSkinButton15Click(Sender: TObject);
procedure bsSkinButton1Click(Sender: TObject);
procedure bsSkinButton18Click(Sender: TObject);
procedure bsSkinButton20Click(Sender: TObject);
procedure DBGridEh2DrawColumnCell(Sender: TObject; const Rect: TRect;
DataCol: Integer; Column: TColumnEh; State: TGridDrawState);
procedure DBGridEh1DrawColumnCell(Sender: TObject; const Rect: TRect;
DataCol: Integer; Column: TColumnEh; State: TGridDrawState);
procedure DBGridEh4DrawColumnCell(Sender: TObject; const Rect: TRect;
DataCol: Integer; Column: TColumnEh; State: TGridDrawState);
procedure DBGridEh5DrawColumnCell(Sender: TObject; const Rect: TRect;
DataCol: Integer; Column: TColumnEh; State: TGridDrawState);
procedure DBGridEh6DrawColumnCell(Sender: TObject; const Rect: TRect;
DataCol: Integer; Column: TColumnEh; State: TGridDrawState);
procedure DBGridEh7DrawColumnCell(Sender: TObject; const Rect: TRect;
DataCol: Integer; Column: TColumnEh; State: TGridDrawState);
procedure bsSkinButton12Click(Sender: TObject);
procedure bsSkinButton16Click(Sender: TObject);
procedure bsSkinButton17Click(Sender: TObject);
procedure bsSkinButton21Click(Sender: TObject);
procedure bsSkinButton22Click(Sender: TObject);
procedure bsSkinButton23Click(Sender: TObject);
procedure bsSkinButton24Click(Sender: TObject);
procedure bsSkinButton13Click(Sender: TObject);
procedure bsSkinButton25Click(Sender: TObject);
procedure Edit12KeyPress(Sender: TObject; var Key: Char);
procedure Edit10KeyPress(Sender: TObject; var Key: Char);
procedure SQLConnectionAccBeforeConnect(Sender: TObject);
procedure SQLConnectionAcc2BeforeConnect(Sender: TObject);
procedure bsSkinButton26Click(Sender: TObject);
procedure DBGridEh3DrawColumnCell(Sender: TObject; const Rect: TRect;
DataCol: Integer; Column: TColumnEh; State: TGridDrawState);
procedure bsSkinButton28Click(Sender: TObject);
procedure bsSkinButton2Click(Sender: TObject);
procedure bsSkinButton29Click(Sender: TObject);
procedure ADOConnection1BeforeConnect(Sender: TObject);
procedure DBGridEh1DblClick(Sender: TObject);
procedure DBGridEh4DblClick(Sender: TObject);
procedure DBGridEh5DblClick(Sender: TObject);
procedure DBGridEh6DblClick(Sender: TObject);
procedure qryVouitemsACCIDChange(Sender: TField);
procedure qryVouitemsAfterPost(DataSet: TDataSet);
procedure qryVouitemsBeforeEdit(DataSet: TDataSet);
procedure qryVouitemsBeforeDelete(DataSet: TDataSet);
procedure bsSkinButton33Click(Sender: TObject);
procedure bsSkinButton32Click(Sender: TObject);
procedure bsSkinButton31Click(Sender: TObject);
procedure bsSkinButton30Click(Sender: TObject);
procedure bsSkinButton19Click(Sender: TObject);
procedure cxGrid1DBTableView1CustomDrawCell(
Sender: TcxCustomGridTableView; ACanvas: TcxCanvas;
AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
procedure bsSkinButton34Click(Sender: TObject);
procedure bsSkinButton35Click(Sender: TObject);
procedure bsSkinButton27Click(Sender: TObject);
procedure bsSkinButton37Click(Sender: TObject);
procedure bsSkinButton36Click(Sender: TObject);
procedure dxDBGrid4DblClick(Sender: TObject);
procedure dxDBGrid6DblClick(Sender: TObject);
procedure dxDBGrid4CustomDraw(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 dxDBGrid2CustomDraw(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 dxDBGrid1CustomDraw(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 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 dxDBGrid5CustomDraw(Sender: TObject; ACanvas: TCanvas;
ARect: TRect; ANode: TdxTreeListNode; AColumn: TdxDBTreeListColumn;
const AText: String; AFont: TFont; var AColor: TColor; ASelected,
AFocused: Boolean; var ADone: Boolean);
private
procedure CreateMemTbl;
function NewDrCrVou(fDataSet:TDataSet;BsType:integer;Mblno:String;voudate:TDate;BillNos:string):String;
function NewDCVou(fDataSet:TDataSet;ZDR:String;voudate:TDatetime):Boolean;
function NewDCVouvat(fDataSet:TDataSet;ZDR:String;voudate:TDatetime):Boolean;
function NewDCVou_Patch(fDataSet:TDataSet;ZDR:String;voudate:TDatetime):Boolean;
function NewDrCrInv(fDataSet:TDataSet;Mblno,ZDR:String;voudate:TDate):String;
function NewDrCrInvCr(fDataSet:TDataSet;Mblno,ZDR:String;voudate:TDate):String;
function InvoiceDr(fDataSet:TDataSet;ZDR:String;voudate:TDatetime):Boolean;
function InvoiceCr(fDataSet:TDataSet;ZDR:String;voudate:TDatetime):Boolean;
function IncomeCost(fDataSet:TDataSet;explan,mblno,corps,Depts,sales:string;ProfitFull,ICUSD:Integer;Dr,Cr,USDDr,USDCr,UTORDr,UTORCr,vatAmtdr,vatAmtCr:Double;sTrade:string):String;
procedure InsertItems(Accid:string;AmtDr,AmtCr:Double;FCYNO:string;FCYDr,FCYCr:Double;explan,mblno,corps,Depts,sales,DC:string);
procedure InsertItemsVat(Accid:string;AmtDr,AmtCr:Double;FCYNO:string;FCYDr,FCYCr,vatAmtDr,vatAmtCr:Double;explan,mblno,corps,Depts,sales,DC:string);
function GetCustID(CorpID,DC:String):String;
function GetEmpID(EmplName:String):String;
function GetDeptID(DeptName:String):String;
function GetEmpDeptID(EmplName:String):String;
function GetBankAccid(fdataSet:TDataSet;bank:string):String;
procedure NewDCVou_select;
procedure NewDCVou_One;
{ Private declarations }
public
vat_value:Double;
function cw_client_yingshou_error():boolean;
function cw_client_yingfu_error():boolean;
function cw_client_shouru_error():boolean;
function cw_client_chengben_error():boolean;
procedure cw_add_1(op_type:integer);
function get_str(i:integer;Dc:string;CorpName:string;data:TDataSet):widestring;
function get_strProfit(i:integer;data:TDataSet):widestring;
function get_strDc(data:TDataSet):widestring;
function get_strInvoice(data:TDataSet):widestring;
function get_billStr(bsNo:string):string;
procedure kingdee;
procedure U8;
procedure U8103;
procedure NewBsVoucher(bstype:integer;TableName,BsField:string;Dbgrid1:TDxDBGrid;aDataset:TADOQuery);
function GetNoCorpNo(BillNos:string): String;
function GetInvoiceNoCorpNo(BillNos:string): String;
function getstrfromdataset(dataset:TDataSet;formatstr:String):string;
function GetBSNoCorpNo(BillNos:string): String;
function checkbsVoucher(Dbgrid1:TDxDBGrid;aDataset:TADOQuery):string;
procedure UpdateVoucherAmt;
{ Public declarations }
end;
var
frm_cw_pingzheng_gj: Tfrm_cw_pingzheng_gj;
frm_cw_pingzheng_open:boolean;
cw_load,cw_load_group:integer;
frm_cw_load_iflog:boolean;
implementation
uses u_main, my_sys_function, dmAccu, u_data_share,
VouItemStlu, u_sys_progress, u_ch_piliang_seae, u_ch_piliang_seai,
u_ch_piliang_aire, u_ch_piliang_airi;
{$R *.dfm}
procedure Tfrm_cw_pingzheng_gj.UpdateVoucherAmt;
var AmtDR, AmtCR,D,C : Double;
OrdNo,Counts : Integer;
ADOQueryTemp:TADOQuery;
begin
OrdNo:=memTblVou.FieldByName('OrdNo').AsInteger;
D:=memTblVou.FieldByName('AmtDR').AsFloat;
C:=memTblVou.FieldByName('AmtCR').AsFloat;
ADOQueryTemp:=CreateAdoQuery;
with ADOQueryTemp do
try
Close;SQL.Clear;
SQL.Add('Select Sum(AmtDR) AmtDR, Sum(AmtCR) AmtCR');
SQL.Add('from VouItems');
SQL.Add(Format('where OrdNo=%d', [OrdNo]));
Open;
AmtDR:=StrToFloatDef(FormatFloat('0.00;-0.00;0.0',FieldByName('AmtDR').AsFloat), 0);
AmtCR:=StrToFloatDef(FormatFloat('0.00;-0.00;0.0',FieldByName('AmtCR').AsFloat), 0);
Close;SQL.Clear;
SQL.Add('Select Count(ItemNo) itemcount from VouItems');
SQL.Add(Format('where OrdNo=%d', [OrdNo]));
Open;
counts:=fieldByName('itemcount').AsInteger;
if (D<>AmtDR)or(C<>AmtCR) then begin
Close;SQL.Clear;
SQL.Add('Update VOUCHERS set AMTDR=:AmtDR,AmtCR=:AmtCR,ITEMSCOUNT=:counts');
SQL.Add(Format('where OrdNo=%d', [OrdNo]));
Parameters.ParamByName('AmtDR').value:=AmtDR;
Parameters.ParamByName('AmtCR').value:=AmtCR;
Parameters.ParamByName('counts').value:=counts;
ExecSQL;
end;
finally
ADOQueryTemp.Free;
end;
{
memTblVou.Edit;
memTblVou.FieldByName('AmtDR').AsFloat:=AmtDR;
memTblVou.FieldByName('AmtCR').AsFloat:=AmtCR;
memTblVou.FieldByName('AmtBLC').AsFloat:=AmtDR-AmtCR;
memTblVou.Post;
}
end;
function Tfrm_cw_pingzheng_gj.GetBSNoCorpNo(BillNos:string): String;
var aAdoQuery:TAdoQuery;
begin
result:='';
aAdoQuery:=CreateAdoQuery;
try
with aAdoQuery do
begin
Close;sql.Clear;
sql.Add('SELECT distinct t_ch_fee.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>,t_crm_Client.<2E><><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD>ʿ<EFBFBD><CABF><EFBFBD><EFBFBD><EFBFBD>');
sql.Add('From t_ch_fee');
sql.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>');
sql.Add('where t_ch_fee.<2E><><EFBFBD><EFBFBD>=:<3A><><EFBFBD><EFBFBD> and t_ch_fee.<2E><><EFBFBD><EFBFBD>='''+BillNos+'''');
Parameters.ParamByName('<27><><EFBFBD><EFBFBD>').Value:='<27><>';
Open;First;
// ShowMessage(sql.text);
while not Eof do
begin
if Trim(FieldByName('<27><><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD>ʿ<EFBFBD><CABF><EFBFBD><EFBFBD><EFBFBD>').AsString)='' then
begin
if result='' then
result:=FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString+' Ӧ<><D3A6>'
else result:=result+#13#10+FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString+' Ӧ<><D3A6>';
end;
Next;
end;
end;
with aAdoQuery do
begin
Close;sql.Clear;
sql.Add('SELECT t_ch_fee.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>,t_crm_Client.<2E><><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD>ʿ<EFBFBD><CABF><EFBFBD><EFBFBD><EFBFBD>');
sql.Add('From t_ch_fee');
sql.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>');
sql.Add('where t_ch_fee.<2E><><EFBFBD><EFBFBD>=:<3A><><EFBFBD><EFBFBD> and t_ch_fee.<2E><><EFBFBD><EFBFBD>='''+BillNos+'''');
Parameters.ParamByName('<27><><EFBFBD><EFBFBD>').Value:='<27><>';
Open;First;
while not Eof do
begin
if Trim(FieldByName('<27><><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD>ʿ<EFBFBD><CABF><EFBFBD><EFBFBD><EFBFBD>').AsString)='' then
begin
if result='' then
result:=FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString+' Ӧ<><D3A6>'
else result:=result+#13#10+FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString+' Ӧ<><D3A6>';
end;
Next;
end;
end;
// showmessage(result);
finally
FreeAndNil(aAdoQuery);
end;
end;
function Tfrm_cw_pingzheng_gj.checkbsVoucher(Dbgrid1:TDxDBGrid;aDataset:TADOQuery):string;
var aQuery:TADOQuery;
i:Integer;
s:string;
begin
Result:='';
s:='';
if Dbgrid1.SelectedCount>1 then
begin
for i:=0 to Dbgrid1.SelectedCount-1 do
begin
aDataset.GotoBookmark(Pointer(Dbgrid1.selectedrows[I]));
s:=GetBSNoCorpNo(aDataset.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString);
if s<>'' then
begin
// showmessage(s+#13#10+'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
Result:=Result+#13#10+s;
end;
end;
end
else
begin
s:=GetBSNoCorpNo(aDataset.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString);
if s<>'' then
begin
// showmessage(s+#13#10+'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
Result:=Result+#13#10+s;
end;
end;
end;
function Tfrm_cw_pingzheng_gj.getstrfromdataset(dataset:TDataSet;formatstr:String):string;
var
i:integer;
str:string;
begin
str:=formatstr;
for i:=0 to dataset.FieldCount-1 do
begin
str:=StringReplace(str,'['+dataset.Fields[i].FieldName+']',dataset.Fields[i].asstring,[]);
end;
result:=str;
end;
function Tfrm_cw_pingzheng_gj.GetNoCorpNo(BillNos:string): String;
var aAdoQuery:TAdoQuery;
begin
result:='';
aAdoQuery:=CreateAdoQuery;
with aAdoQuery do
try
Close;sql.Clear;
sql.Add('Select distinct v_fee_balance_items.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>,t_crm_Client.<2E><><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD>ʿ<EFBFBD><CABF><EFBFBD><EFBFBD><EFBFBD>');
sql.Add('from v_fee_balance_items ');
sql.Add('Left Join t_crm_Client on v_fee_balance_items.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>=t_crm_Client.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>');
sql.Add('where v_fee_balance_items.<2E>ո<EFBFBD>=:<3A><><EFBFBD><EFBFBD> and v_fee_balance_items.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>='''+BillNos+'''');
Parameters.ParamByName('<27><><EFBFBD><EFBFBD>').Value:='<27><>';
Open;First;
while not Eof do
begin
if Trim(FieldByName('<27><><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD>ʿ<EFBFBD><CABF><EFBFBD><EFBFBD><EFBFBD>').AsString)='' then
begin
if result='' then
result:=FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString+' Ӧ<><D3A6>'
else result:=result+#13#10+FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString+' Ӧ<><D3A6>';
end;
Next;
end;
Close;sql.Clear;
sql.Add('Select distinct v_fee_balance_items.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>,t_crm_Client.<2E><><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD>ʿ<EFBFBD><CABF><EFBFBD><EFBFBD><EFBFBD>');
sql.Add('from v_fee_balance_items ');
sql.Add('Left Join t_crm_Client on v_fee_balance_items.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>=t_crm_Client.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>');
sql.Add('where v_fee_balance_items.<2E>ո<EFBFBD>=:<3A><><EFBFBD><EFBFBD> and v_fee_balance_items.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>='''+BillNos+'''');
Parameters.ParamByName('<27><><EFBFBD><EFBFBD>').Value:='<27><>';
Open;First;
while not Eof do
begin
if Trim(FieldByName('<27><><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD>ʿ<EFBFBD><CABF><EFBFBD><EFBFBD><EFBFBD>').AsString)='' then
begin
if result='' then
result:=FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString+'Ӧ<><D3A6>'
else result:=result+#13#10+FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString+'Ӧ<><D3A6>';
end;
Next;
end;
finally
FreeAndNil(aAdoQuery);
end;
end;
function Tfrm_cw_pingzheng_gj.GetInvoiceNoCorpNo(BillNos:string): String;
var aAdoQuery:TAdoQuery;
begin
result:='';
aAdoQuery:=CreateAdoQuery;
with aAdoQuery do
try
Close;sql.Clear;
sql.Add('Select distinct v_fee_do_bscard.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>,t_crm_Client.<2E><><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD>ʿ<EFBFBD><CABF><EFBFBD><EFBFBD><EFBFBD>');
sql.Add('from v_fee_do_bscard ');
sql.Add('Left Join t_crm_Client on v_fee_do_bscard.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>=t_crm_Client.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>');
sql.Add('where v_fee_do_bscard.<2E><><EFBFBD><EFBFBD>=:<3A><><EFBFBD><EFBFBD> and v_fee_do_bscard.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>='''+BillNos+'''');
Parameters.ParamByName('<27><><EFBFBD><EFBFBD>').Value:='<27><>';
Open;First;
while not Eof do
begin
if Trim(FieldByName('<27><><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD>ʿ<EFBFBD><CABF><EFBFBD><EFBFBD><EFBFBD>').AsString)='' then
begin
if result='' then
result:=FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString+' Ӧ<><D3A6>'
else result:=result+#13#10+FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString+' Ӧ<><D3A6>';
end;
Next;
end;
Close;sql.Clear;
sql.Add('Select distinct v_fee_do_bscard.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>,t_crm_Client.<2E><><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD>ʿ<EFBFBD><CABF><EFBFBD><EFBFBD><EFBFBD>');
sql.Add('from v_fee_do_bscard ');
sql.Add('Left Join t_crm_Client on v_fee_do_bscard.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>=t_crm_Client.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>');
sql.Add('where v_fee_do_bscard.<2E><><EFBFBD><EFBFBD>=:<3A><><EFBFBD><EFBFBD> and v_fee_do_bscard.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>='''+BillNos+'''');
Parameters.ParamByName('<27><><EFBFBD><EFBFBD>').Value:='<27><>';
Open;First;
while not Eof do
begin
if Trim(FieldByName('<27><><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD>ʿ<EFBFBD><CABF><EFBFBD><EFBFBD><EFBFBD>').AsString)='' then
begin
if result='' then
result:=FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString+'Ӧ<><D3A6>'
else result:=result+#13#10+FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString+'Ӧ<><D3A6>';
end;
Next;
end;
finally
FreeAndNil(aAdoQuery);
end;
end;
function Tfrm_cw_pingzheng_gj.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_cw_pingzheng_gj.GetEmpID(EmplName:String):String;
begin
with dmAcc.tempQuery do
try
Close;SQL.Clear;
SQL.Add('select <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> from t_sys_employee where <20><><EFBFBD><EFBFBD>='''+EmplName+'''');
Open;
if not FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').IsNull then
Result:=FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString
else Result:='0';
finally
Close;
end;
end;
function Tfrm_cw_pingzheng_gj.GetDeptID(DeptName:String):String;
var
aQry:TAdoQuery;
begin
aQry:=CreateadoQuery;
try
aQry.Close;
aQry.SQL.Clear;
aQry.sql.add('select <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> from t_sys_department where <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>='''+DeptName+'''');
aQry.Open;
result:=aQry.fieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring;
finally
FreeAndNil(aQry);
end;
end;
function Tfrm_cw_pingzheng_gj.GetEmpDeptID(EmplName:String):String;
var
aQry:TAdoQuery;
begin
aQry:=CreateadoQuery;
try
aQry.Close;
aQry.SQL.Clear;
aQry.sql.add('select e.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,d.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> from t_sys_employee e left join t_sys_department d on (d.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>=e.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) where e.<2E><><EFBFBD><EFBFBD>='''+EmplName+'''');
aQry.Open;
result:=aQry.fieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring;
finally
FreeAndNil(aQry);
end;
end;
function Tfrm_cw_pingzheng_gj.GetBankAccid(fdataSet:TDataSet;bank:string):String;
var
aQuery:TAdoQuery;
begin
if fdataSet.FieldByName('<27><><EFBFBD>ʽ').AsString='<27>ֽ<EFBFBD>' then
if strtobool(get_parameters_value(83,'false')) then
begin
result:=t_cw_design.FieldByName('Ӧ<>պ<EFBFBD><D5BA><EFBFBD>һ').AsString;
end
else
begin
aQuery:=CreateAdoQuery;
with aQuery do
try
Close;sql.Clear;
sql.Add('select <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> from t_sys_bank');
sql.Add('where <20><><EFBFBD><EFBFBD>='''+fDataSet.fieldbyname('<27><><EFBFBD>д<EFBFBD><D0B4><EFBFBD>').AsString+'''');
Open;
if Recordcount<>0 then
result:=fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString
else
result:=t_cw_design.FieldByName('Ӧ<>պ<EFBFBD><D5BA><EFBFBD>һ').AsString;
finally
freeAndNil(aQuery);
end;
// result:=t_cw_design.FieldByName('Ӧ<>պ<EFBFBD><D5BA><EFBFBD>һ').AsString;
end
else
begin
if strtobool(get_parameters_value(83,'false')) then
begin
aQuery:=CreateAdoQuery;
with aQuery do
try
Close;sql.Clear;
sql.Add('select <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> from t_sys_bank');
if bank='USD' then
sql.Add('where <20><><EFBFBD><EFBFBD>='''+fDataSet.fieldbyname('<27><>Ԫ<EFBFBD><D4AA><EFBFBD>д<EFBFBD><D0B4><EFBFBD>').AsString+'''')
else sql.Add('where <20><><EFBFBD><EFBFBD>='''+fDataSet.fieldbyname('<27><><EFBFBD>д<EFBFBD><D0B4><EFBFBD>').AsString+'''');
Open;
if Recordcount<>0 then
result:=fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString
else
result:='';
finally
freeAndNil(aQuery);
end;
end
else
begin
aQuery:=CreateAdoQuery;
with aQuery do
try
Close;sql.Clear;
sql.Add('select <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> from t_sys_bank');
sql.Add('where <20><><EFBFBD><EFBFBD>='''+fDataSet.fieldbyname('<27><><EFBFBD>д<EFBFBD><D0B4><EFBFBD>').AsString+'''');
Open;
if Recordcount<>0 then
result:=fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString
else
result:='';
finally
freeAndNil(aQuery);
end;
end;
begin
end;
end;
end;
procedure Tfrm_cw_pingzheng_gj.InsertItems(Accid:string;AmtDr,AmtCr:Double;FCYNO:string;FCYDr,FCYCr:Double;explan,mblno,corps,Depts,sales,DC:string);
function GetEmpID(EmplName:String):String;
begin
with dmAcc.tempQuery do
try
Close;SQL.Clear;
SQL.Add('select <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> from t_sys_employee where <20><><EFBFBD><EFBFBD>='''+EmplName+'''');
Open;
if not FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').IsNull then
Result:=FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString
else Result:='0';
finally
Close;
end;
end;
begin
dmAcc.AdotblVouItems.Insert;
if FCYDr<>0 then
dmAcc.AdotblVouItems.FieldByName('FCYEXRATE').AsFloat:=StrToFloatDef(FormatFloat('0.0000;-0.0000;0.0', AmtDr/FCYDr), 0)
else
if FCYCr<>0 then
dmAcc.AdotblVouItems.FieldByName('FCYEXRATE').AsFloat:=StrToFloatDef(FormatFloat('0.0000;-0.0000;0.0', AmtCr/FCYCr), 0)
else
dmAcc.AdotblVouItems.FieldByName('FCYNO').AsString:=FCYNO;
dmAcc.AdotblVouItems.FieldByName('FCYDR').AsFloat:=FCYDr;
dmAcc.AdotblVouItems.FieldByName('FCYCr').AsFloat:=FCYCr;
// dmAcc.AdotblVouItems.FieldByName('FCYEXRATE').AsFloat:=0;
dmAcc.AdotblVouItems.FieldByName('AccID').AsString:=Accid;
dmAcc.AdotblVouItems.FieldByName('AmtDr').AsFloat:=AmtDr;
dmAcc.AdotblVouItems.FieldByName('AmtCr').AsFloat:=AmtCr;
// ShowMessage(FloatToStr(AmtCr)+' '+FloatToStr(Amtdr));
dmAcc.AdotblVouItems.FieldByName('explan').AsString:=explan;
dmAcc.AdotblVouItems.FieldByName('BSNO').AsString:=Mblno;
if t_Accitems.Locate('accid',Accid,[]) then
begin
if t_Accitems.FieldByName('EmplACC').AsString='T' then
begin
dmAcc.AdotblVouItems.FieldByName('CorpID').AsString:=GetEmpID(sales);
dmAcc.AdotblVouItems.FieldByName('QTYSPECS').AsString:=AccInfo.SaleKindName; // <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>
end;
end;
dmAcc.AdotblVouItems.FieldByName('CorpBf').AsString:='F';
dmAcc.AdotblVouItems.Post;
end;
{
dmAcc.AdotblVouItems.Insert;
if FCYDr<>0 then
dmAcc.AdotblVouItems.FieldByName('FCYEXRATE').AsFloat:=StrToFloatDef(FormatFloat('0.0000;-0.0000;0.0', AmtDr/FCYDr), 0)
else
if FCYCr<>0 then
dmAcc.AdotblVouItems.FieldByName('FCYEXRATE').AsFloat:=StrToFloatDef(FormatFloat('0.0000;-0.0000;0.0', AmtCr/FCYCr), 0)
else
dmAcc.AdotblVouItems.FieldByName('FCYEXRATE').AsFloat:=0;
dmAcc.AdotblVouItems.FieldByName('AccID').AsString:=Accid;
dmAcc.AdotblVouItems.FieldByName('AmtDr').AsFloat:=AmtDr;
dmAcc.AdotblVouItems.FieldByName('AmtCr').AsFloat:=AmtCr;
dmAcc.AdotblVouItems.FieldByName('FCYNO').AsString:=FCYNO;
dmAcc.AdotblVouItems.FieldByName('FCYDR').AsFloat:=FCYDr;
dmAcc.AdotblVouItems.FieldByName('FCYCr').AsFloat:=FCYCr;
dmAcc.AdotblVouItems.FieldByName('explan').AsString:=explan;
dmAcc.AdotblVouItems.FieldByName('BSNO').AsString:=Mblno;
if t_Accitems.Locate('accid',Accid,[]) then
begin
if t_Accitems.FieldByName('EmplACC').AsString='T' then
begin
dmAcc.AdotblVouItems.FieldByName('CorpID').AsString:=GetEmpID(sales);
dmAcc.AdotblVouItems.FieldByName('QTYSPECS').AsString:=AccInfo.SaleKindName; // <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>
end;
end;
dmAcc.AdotblVouItems.FieldByName('CorpBf').AsString:='F';
/////
dmAcc.AdotblVouItems.Post;
dmAcc.AdotblVouItems.FieldByName('CorpID').AsString:=GetCustID(aQuery.fieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString,'<27><>');;
dmAcc.AdotblVouItems.FieldByName('CorpBf').AsString:='F';
dmAcc.AdotblVouItems.FieldByName('QTYSPECS').AsString:=AccInfo.SuppKindName; // <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>
dmAcc.AdotblVouItems.FieldByName('DEPTID').AsString:=GetDeptID(fDataSet.fieldByName('<27><><EFBFBD>۲<EFBFBD><DBB2><EFBFBD>').AsString);
dmAcc.AdotblVouItems.FieldByName('EMPLID').AsString:=GetEmpID(fDataSet.fieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString);
}
procedure Tfrm_cw_pingzheng_gj.InsertItemsVat(Accid:string;AmtDr,AmtCr:Double;FCYNO:string;FCYDr,FCYCr,vatAmtDr,vatAmtCr:Double;explan,mblno,corps,Depts,sales,DC:string);
var Amt,Amtvat:Double;
function GetEmpID(EmplName:String):String;
begin
with dmAcc.tempQuery do
try
Close;SQL.Clear;
SQL.Add('select <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> from t_sys_employee where <20><><EFBFBD><EFBFBD>='''+EmplName+'''');
Open;
if not FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').IsNull then
Result:=FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString
else Result:='0';
finally
Close;
end;
end;
begin
// AccInfo.Taxes_Income:=t_cw_design.fieldbyname('<27><><EFBFBD><EFBFBD>˰').AsString;
// AccInfo.Taxes_Cost:=t_cw_design.fieldbyname('<27><><EFBFBD><EFBFBD>˰').AsString;
if DC='C' then
begin
Amtvat:=0;
Amt:=0;
Amtvat:=s_w(2,AmtCr/(1+frm_data_share.t_sys_company.fieldbyname('˰<><CBB0>').AsFloat/100)*frm_data_share.t_sys_company.fieldbyname('˰<><CBB0>').AsFloat/100);
Amt:=AmtCr-Amtvat;
dmAcc.AdotblVouItems.Insert;
dmAcc.AdotblVouItems.FieldByName('FCYEXRATE').AsFloat:=0;
dmAcc.AdotblVouItems.FieldByName('AccID').AsString:=Accid;
dmAcc.AdotblVouItems.FieldByName('AmtDr').AsFloat:=0;
dmAcc.AdotblVouItems.FieldByName('AmtCr').AsFloat:=vatAmtDr;
dmAcc.AdotblVouItems.FieldByName('FCYNO').AsString:='RMB';
dmAcc.AdotblVouItems.FieldByName('FCYDR').AsFloat:=0;
dmAcc.AdotblVouItems.FieldByName('FCYCr').AsFloat:=0;
dmAcc.AdotblVouItems.FieldByName('explan').AsString:=explan;
dmAcc.AdotblVouItems.FieldByName('BSNO').AsString:=Mblno;
if t_Accitems.Locate('accid',Accid,[]) then
begin
if t_Accitems.FieldByName('CORPACC').AsString='T' then
begin
dmAcc.AdotblVouItems.FieldByName('CorpID').AsString:=GetCustID(corps,'<27><>');
dmAcc.AdotblVouItems.FieldByName('QTYSPECS').AsString:=AccInfo.CustKindName; // <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>
end;
if t_Accitems.FieldByName('EMPLACC').AsString='T' then
begin
dmAcc.AdotblVouItems.FieldByName('EmplID').AsString:=GetEmpID(sales);
end;
end;
dmAcc.AdotblVouItems.FieldByName('Field1').AsString:=sales;
dmAcc.AdotblVouItems.FieldByName('CorpBf').AsString:='F';
dmAcc.AdotblVouItems.Post;
if AmtCr-vatAmtDr<>0 then
begin
dmAcc.AdotblVouItems.Insert;
dmAcc.AdotblVouItems.FieldByName('FCYEXRATE').AsFloat:=0;
if AccInfo.ifPreTaxes then
dmAcc.AdotblVouItems.FieldByName('AccID').AsString:=AccInfo.PreTaxes_Income
else dmAcc.AdotblVouItems.FieldByName('AccID').AsString:=AccInfo.Taxes_Income;
dmAcc.AdotblVouItems.FieldByName('AmtDr').AsFloat:=0;
dmAcc.AdotblVouItems.FieldByName('AmtCr').AsFloat:=s_w(2,AmtCr-vatAmtDr);
dmAcc.AdotblVouItems.FieldByName('FCYNO').AsString:='RMB';
dmAcc.AdotblVouItems.FieldByName('FCYDR').AsFloat:=0;
dmAcc.AdotblVouItems.FieldByName('FCYCr').AsFloat:=0;
dmAcc.AdotblVouItems.FieldByName('explan').AsString:=explan;
dmAcc.AdotblVouItems.FieldByName('BSNO').AsString:=Mblno;
dmAcc.AdotblVouItems.FieldByName('CorpBf').AsString:='F';
dmAcc.AdotblVouItems.Post;
end;
end
else
if DC='D' then
begin
if vatAmtCr<>0 then
begin
dmAcc.AdotblVouItems.Insert;
dmAcc.AdotblVouItems.FieldByName('FCYEXRATE').AsFloat:=0;
dmAcc.AdotblVouItems.FieldByName('AccID').AsString:=Accid;
dmAcc.AdotblVouItems.FieldByName('AmtDr').AsFloat:=vatAmtCr;
dmAcc.AdotblVouItems.FieldByName('AmtCr').AsFloat:=0;
dmAcc.AdotblVouItems.FieldByName('FCYNO').AsString:='RMB';
dmAcc.AdotblVouItems.FieldByName('FCYDR').AsFloat:=0;
dmAcc.AdotblVouItems.FieldByName('FCYCr').AsFloat:=0;
dmAcc.AdotblVouItems.FieldByName('explan').AsString:=explan;
dmAcc.AdotblVouItems.FieldByName('BSNO').AsString:=Mblno;
if t_Accitems.Locate('accid',Accid,[]) then
begin
if t_Accitems.FieldByName('CORPACC').AsString='T' then
begin
dmAcc.AdotblVouItems.FieldByName('CorpID').AsString:=GetCustID(corps,'<27><>');
dmAcc.AdotblVouItems.FieldByName('QTYSPECS').AsString:=AccInfo.CustKindName; // <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>
end;
if t_Accitems.FieldByName('EMPLACC').AsString='T' then
begin
dmAcc.AdotblVouItems.FieldByName('EmplID').AsString:=GetEmpID(sales);
end;
end;
dmAcc.AdotblVouItems.FieldByName('Field1').AsString:=sales;
dmAcc.AdotblVouItems.FieldByName('CorpBf').AsString:='F';
dmAcc.AdotblVouItems.Post;
end;
if AmtDr-vatAmtCr<>0 then
begin
dmAcc.AdotblVouItems.Insert;
dmAcc.AdotblVouItems.FieldByName('FCYEXRATE').AsFloat:=0;
if AccInfo.ifPreTaxes then
dmAcc.AdotblVouItems.FieldByName('AccID').AsString:=AccInfo.PreTaxes_Cost
else dmAcc.AdotblVouItems.FieldByName('AccID').AsString:=AccInfo.Taxes_Cost;
dmAcc.AdotblVouItems.FieldByName('AmtDr').AsFloat:=s_w(2,AmtDr-vatAmtCr);
dmAcc.AdotblVouItems.FieldByName('AmtCr').AsFloat:=0;
dmAcc.AdotblVouItems.FieldByName('FCYNO').AsString:='RMB';
dmAcc.AdotblVouItems.FieldByName('FCYDR').AsFloat:=0;
dmAcc.AdotblVouItems.FieldByName('FCYCr').AsFloat:=0;
dmAcc.AdotblVouItems.FieldByName('explan').AsString:=explan;
dmAcc.AdotblVouItems.FieldByName('BSNO').AsString:=Mblno;
dmAcc.AdotblVouItems.FieldByName('CorpBf').AsString:='F';
dmAcc.AdotblVouItems.Post;
end;
end;
end;
function Tfrm_cw_pingzheng_gj.IncomeCost(fDataSet:TDataSet;explan,mblno,corps,Depts,sales:string;ProfitFull,ICUSD:Integer;Dr,Cr,USDDr,USDCr,UTORDr,UTORCr,vatAmtDr,vatAmtCr:Double;sTrade:string):String;
var aAdoQuery:TAdoQuery;
TradeaccDr,TradeaccCr,ExplanIncome,ExplanCost:string;
begin
ExplanIncome:='';
ExplanCost:='';
aAdoQuery:=CreateAdoQuery;
with aAdoQuery do
try
close;SQL.Clear;
SQL.Add('select <20><><EFBFBD><EFBFBD> ,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD><EFBFBD>ɱ<EFBFBD><C9B1><EFBFBD><EFBFBD><EFBFBD> ');
SQL.Add('from t_code_airtrade');
SQL.Add('UNION ALL');
SQL.Add('select <20><><EFBFBD><EFBFBD> ,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD><EFBFBD>ɱ<EFBFBD><C9B1><EFBFBD><EFBFBD><EFBFBD> ');
SQL.Add('from t_code_trade');
Open;First;
if Locate('<27><><EFBFBD><EFBFBD>',sTrade,[]) then
begin
TradeaccDr:=FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString;
TradeaccCr:=FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD>ɱ<EFBFBD><C9B1><EFBFBD><EFBFBD><EFBFBD>').AsString;
end;
finally
Free;
end;
if Trim(TradeaccDr)<>'' then
AccInfo.ProfitAccID:=Trim(TradeaccDr);
if Trim(TradeaccCr)<>'' then
AccInfo.ImpProfitAccID:=Trim(TradeaccCr);
if (t_cw_design.fieldByName('<27><>Ӫҵ<D3AA><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ժҪ').AsString='')
and (t_cw_design.fieldByName('<27><>Ӫҵ<D3AA><D2B5><EFBFBD>ɱ<EFBFBD>ժҪ').AsString='')
then
begin
ExplanIncome:=explan;
ExplanCost:=explan;
end
else
begin
ExplanIncome:=getstrfromdataset(fDataSet,t_cw_design.fieldByName('<27><>Ӫҵ<D3AA><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ժҪ').AsString);
ExplanCost:=getstrfromdataset(fDataSet,t_cw_design.fieldByName('<27><>Ӫҵ<D3AA><D2B5><EFBFBD>ɱ<EFBFBD>ժҪ').AsString);
end;
if ProfitFull=0 then //ȫ<><C8AB>
begin
if ICUSD=0 then
begin //<2F><><EFBFBD><EFBFBD><EFBFBD>ɱ<EFBFBD><C9B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>usd
if (Dr+UTORDr)<>0 then
begin
InsertItemsVat(AccInfo.ProfitAccID,0,Dr+UTORDr,'RMB',0,0,vatAmtDr,vatAmtCr,ExplanIncome,mblno,corps,Depts,sales,'C')
end;
if (Cr+UTORCr)<>0 then
begin
InsertItemsVat(AccInfo.ImpProfitAccID,Cr+UTORCr,0,'RMB',0,0,vatAmtDr,vatAmtCr,ExplanCost,mblno,corps,Depts,sales,'D')
end;
end;
end;
end;
{ if ProfitFull=0 then //ȫ<><C8AB>
begin
if ICUSD=0 then
begin //<2F><><EFBFBD><EFBFBD><EFBFBD>ɱ<EFBFBD><C9B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>usd
if (Dr+UTORDr)<>0 then
begin
if AccInfo.ifvat then
InsertItemsVat(AccInfo.ProfitAccID,0,Dr+UTORDr,'RMB',0,0,ExplanIncome,mblno,corps,Depts,sales,'C')
else
InsertItems(AccInfo.ProfitAccID,0,Dr+UTORDr,'RMB',0,0,ExplanIncome,mblno,corps,Depts,sales,'C');
end;
if (Cr+UTORCr)<>0 then
begin
if AccInfo.ifvat then
InsertItemsVat(AccInfo.ImpProfitAccID,Cr+UTORCr,0,'RMB',0,0,ExplanCost,mblno,corps,Depts,sales,'D')
else InsertItems(AccInfo.ImpProfitAccID,Cr+UTORCr,0,'RMB',0,0,ExplanCost,mblno,corps,Depts,sales,'D');
end;
end
else
begin
if USDDr<>0 then
begin
if AccInfo.ifvat then
InsertItemsVat(AccInfo.ProfitAccIDU,0,UTORDr,'USD',0,USDDr,ExplanIncome,mblno,corps,Depts,sales,'C')
else InsertItems(AccInfo.ProfitAccIDU,0,UTORDr,'USD',0,USDDr,ExplanIncome,mblno,corps,Depts,sales,'C');
end;
if USDCr<>0 then
begin
if AccInfo.ifvat then
InsertItemsVat(AccInfo.ImpProfitAccIDU,UTORCr,0,'USD',USDCr,0,ExplanCost,mblno,corps,Depts,sales,'D')
else InsertItems(AccInfo.ImpProfitAccIDU,UTORCr,0,'USD',USDCr,0,ExplanCost,mblno,corps,Depts,sales,'D');
end;
if Dr<>0 then
begin
if AccInfo.ifvat then
InsertItemsVat(AccInfo.ProfitAccID,0,Dr,'RMB',0,0,ExplanIncome,mblno,corps,Depts,sales,'C')
else InsertItems(AccInfo.ProfitAccID,0,Dr,'RMB',0,0,ExplanIncome,mblno,corps,Depts,sales,'C');
end;
if Cr<>0 then
begin
if AccInfo.ifvat then
InsertItemsVat(AccInfo.ImpProfitAccID,Cr,0,'RMB',0,0,ExplanCost,mblno,corps,Depts,sales,'D')
else InsertItems(AccInfo.ImpProfitAccID,Cr,0,'RMB',0,0,ExplanCost,mblno,corps,Depts,sales,'D');
end;
end;
end
else
begin
if ICUSD=0 then
begin //<2F><><EFBFBD><EFBFBD><EFBFBD>ɱ<EFBFBD><C9B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>usd
if (Dr+UTORDr-UTORCr-Cr)<>0 then
if AccInfo.ifvat then
InsertItemsVat(AccInfo.ProfitAccID,0,Dr+UTORDr-UTORCr-Cr,'RMB',0,0,ExplanIncome,mblno,corps,Depts,sales,'DC')
else InsertItems(AccInfo.ProfitAccID,0,Dr+UTORDr-UTORCr-Cr,'RMB',0,0,ExplanIncome,mblno,corps,Depts,sales,'DC');
end
else
begin
if (USDDr-USDCr)<>0 then
begin
if AccInfo.ifvat then
InsertItemsVat(AccInfo.ProfitAccIDU,0,UTORDr-UTORCr,'USD',0,USDDr-USDCr,ExplanIncome,mblno,corps,Depts,sales,'DC')
else InsertItems(AccInfo.ProfitAccIDU,0,UTORDr-UTORCr,'USD',0,USDDr-USDCr,ExplanIncome,mblno,corps,Depts,sales,'DC');
end;
if (Dr-Cr)<>0 then
begin
if AccInfo.ifvat then
InsertItemsVat(AccInfo.ProfitAccID,0,Dr-Cr,'RMB',0,0,ExplanIncome,mblno,corps,Depts,sales,'DC')
else InsertItems(AccInfo.ProfitAccID,0,Dr-Cr,'RMB',0,0,ExplanIncome,mblno,corps,Depts,sales,'DC');
end;
end;
end;
}
function Tfrm_cw_pingzheng_gj.NewDrCrVou(fDataSet:TDataSet;BsType:integer;Mblno:String;voudate:TDate;BillNos:string):String;
var
aQuery,aQuery2:TADOQuery;
Dr,Cr,USDDr,USDCr,UTORDr,UTORCr,UDrttl,UCrttl,UsdExrate,vatAmtDr,vatAmtCr:Real;
aPeriod,corps,Depts,sales,sTrade,explan:String;
begin
Result:='';
aQuery:=createADOQuery;
aQuery2:=CreateADOQuery;
Dr:=0.0;
Cr:=0.0;
USDDr:=0.0;
USDCr:=0.0;
UTORDR:=0.0;
UTORCr:=0.0;
vatAmtCr:=0.0;
vatAmtDr:=0.0;
Depts:='';
sales:='';
UsdExRate:=StrToFloatDef(Edit10.Text,7.8);
try
dmAcc.AdotblVou.Insert;
dmAcc.AdotblVou.FieldByName('SourceType').AsInteger:=1;
dmAcc.AdotblVou.FieldByName('ATTACHS').AsInteger:=AccInfo.ATTACHS;
if Trim(AccInfo.TransName)<>'' then
dmAcc.AdotblVou.FieldByName('VKNO').AsString:=AccInfo.TransName
else dmAcc.AdotblVou.FieldByName('VKNO').AsString:='<27><>';
dmAcc.AdotblVou.FieldByName('PREPARED').AsString:=RxDBLookupCombo6.DisplayValues[0];
dmAcc.AdotblVou.Post;
dmAcc.AdotblVou.Edit;
with aQuery,SQL do
begin
Close;sql.Clear;
Add('SELECT t_ch_fee.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>,t_crm_Client.<2E>ͻ<EFBFBD>ȫ<EFBFBD><C8AB>,t_ch_fee.<2E><><EFBFBD><EFBFBD>,t_ch_fee.<2E>ұ<EFBFBD>,t_ch_fee.<2E>Ƿ<EFBFBD><C7B7>渶');
Add(',V_op_bscard_All.ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,V_op_bscard_All.ί<>б<EFBFBD><D0B1><EFBFBD>,V_op_bscard_All.<2E><><EFBFBD><EFBFBD><E1B5A5>,V_op_bscard_All.<2E><><EFBFBD><EFBFBD>,V_op_bscard_All.<2E><><EFBFBD><EFBFBD>,V_op_bscard_All.<2E><><EFBFBD><EFBFBD>');
if AccInfo.AccItem=1 then
Add(',t_Code_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
Add(',SUM(t_ch_fee.<2E><><EFBFBD><EFBFBD>) AS <20><><EFBFBD><EFBFBD>,SUM(t_ch_fee.<2E><><EFBFBD><EFBFBD>*t_ch_fee.<2E><><EFBFBD><EFBFBD>) AS <20>ϼƽ<CFBC><C6BD><EFBFBD>,SUM(t_ch_fee.<2E><><EFBFBD>񲻺<EFBFBD>˰<EFBFBD><CBB0>) AS <20><><EFBFBD><EFBFBD>˰<EFBFBD><CBB0>');
Add('From t_ch_fee');
if AccInfo.AccItem=1 then
Add('Left Join t_Code_fee on t_ch_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>=t_Code_fee.<2E><><EFBFBD><EFBFBD><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('Left Join V_op_bscard_All on t_ch_fee.<2E><><EFBFBD><EFBFBD>=V_op_bscard_All.<2E><><EFBFBD><EFBFBD>');
Add('WHERE t_ch_fee. <20><><EFBFBD><EFBFBD>=:<3A><><EFBFBD><EFBFBD> and t_ch_fee.<2E><><EFBFBD><EFBFBD> in ('+BillNos+')');
Add('GROUP BY t_ch_fee.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>,t_crm_Client.<2E>ͻ<EFBFBD>ȫ<EFBFBD><C8AB>,t_ch_fee.<2E><><EFBFBD><EFBFBD>,t_ch_fee.<2E>ұ<EFBFBD>,t_ch_fee.<2E>Ƿ<EFBFBD><C7B7>渶');
Add(',V_op_bscard_All.ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,V_op_bscard_All.ί<>б<EFBFBD><D0B1><EFBFBD>,V_op_bscard_All.<2E><><EFBFBD><EFBFBD><E1B5A5>,V_op_bscard_All.<2E><><EFBFBD><EFBFBD>,V_op_bscard_All.<2E><><EFBFBD><EFBFBD>');
if AccInfo.AccItem=1 then
Add(',t_Code_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
Add('ORDER BY t_ch_fee.<2E>ұ<EFBFBD> DESC,t_ch_fee.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>');
if AccInfo.AccItem=1 then
Add(',t_Code_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ');
Parameters.ParamByName('<27><><EFBFBD><EFBFBD>').Value:='<27><>';
Open;
end;
Result:=dmAcc.AdotblVou.fieldByName('VOUNO').AsString;
aQuery.First;
while not aQuery.Eof do
begin
dmAcc.AdotblVouItems.Insert;
if t_cw_design.FieldByName('ƾ֤<C6BE><D6A4>ֹ<EFBFBD>޸<EFBFBD>').AsBoolean then
dmAcc.AdotblVouItems.FieldByName('CF').AsInteger:=1;
if aQuery.FieldByName('<27>ұ<EFBFBD>').AsString='USD' then
begin
if aQuery.fieldByName('<27>Ƿ<EFBFBD><C7B7>渶').AsBoolean then
dmAcc.AdotblVouItems.FieldByName('AccID').AsString:=AccInfo.OtherDebitAccID
else dmAcc.AdotblVouItems.FieldByName('AccID').AsString:=AccInfo.DebitAccIDU;
if bsSkinCheckRadioBox7.Checked then
dmAcc.AdotblVouItems.FieldByName('FCYEXRATE').AsFloat:=aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat
else
dmAcc.AdotblVouItems.FieldByName('FCYEXRATE').AsFloat:=UsdExRate;
dmAcc.AdotblVouItems.FieldByName('FCYDR').AsFloat:=StrToFloatDef(FormatFloat('0.00;-0.00;0.0', aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat), 0);
USDDr:=USDDr+dmAcc.AdotblVouItems.FieldByName('FCYDR').AsFloat;
dmAcc.AdotblVouItems.FieldByName('FCYCr').AsFloat:=0.0;
dmAcc.AdotblVouItems.FieldByName('FCYNO').AsString:='USD';
if bsSkinCheckRadioBox7.Checked then
begin
dmAcc.AdotblVouItems.FieldByName('AmtDr').AsFloat:=StrToFloatDef(FormatFloat('0.00;-0.00;0',
StrToFloat(FloatToStr(aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat*aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat))), 0);
if not aQuery.fieldByName('<27>Ƿ<EFBFBD><C7B7>渶').AsBoolean then
UTORDR:=UTORDR+dmAcc.AdotblVouItems.FieldByName('AmtDr').AsFloat;
// ShowMessage(FormatFloat('0.00;-0.00;0.0',aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat*aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat));
vatAmtDr:=vatAmtDr+StrToFloatDef(FormatFloat('0.00;-0.00;0.0',
StrToFloat(FloatToStr(aQuery.fieldByName('<27><><EFBFBD><EFBFBD>˰<EFBFBD><CBB0>').AsFloat*aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat))), 0);
end
else
begin
dmAcc.AdotblVouItems.FieldByName('AmtDr').AsFloat:=StrToFloatDef(FormatFloat('0.00;-0.00;0.0',
StrToFloat(FloatToStr(aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat*UsdExRate))), 0);
if not aQuery.fieldByName('<27>Ƿ<EFBFBD><C7B7>渶').AsBoolean then
UTORDR:=UTORDR+dmAcc.AdotblVouItems.FieldByName('AmtDr').AsFloat;
vatAmtDr:=vatAmtDr+StrToFloatDef(FormatFloat('0.00;-0.00;0.0',StrToFloat(FloatToStr(aQuery.fieldByName('<27><><EFBFBD><EFBFBD>˰<EFBFBD><CBB0>').AsFloat*UsdExRate))), 0);
end;
dmAcc.AdotblVouItems.FieldByName('AmtCr').AsFloat:=0.0;
end else begin
if aQuery.fieldByName('<27>Ƿ<EFBFBD><C7B7>渶').AsBoolean then
dmAcc.AdotblVouItems.FieldByName('AccID').AsString:=AccInfo.OtherDebitAccID
else dmAcc.AdotblVouItems.FieldByName('AccID').AsString:=AccInfo.DebitAccID;
dmAcc.AdotblVouItems.FieldByName('AmtDr').AsFloat:=StrToFloatDef(FormatFloat('0.00;-0.00;0.0',aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat),0);
dmAcc.AdotblVouItems.FieldByName('AmtCr').AsFloat:=0.0;
dmAcc.AdotblVouItems.FieldByName('FCYNO').AsString:='RMB';
dmAcc.AdotblVouItems.FieldByName('FCYDR').AsFloat:=0.0;
dmAcc.AdotblVouItems.FieldByName('FCYCr').AsFloat:=0.0;
dmAcc.AdotblVouItems.FieldByName('FCYEXRATE').AsFloat:=0.0;
if not aQuery.fieldByName('<27>Ƿ<EFBFBD><C7B7>渶').AsBoolean then
Dr:=DR+StrToFloatDef(FormatFloat('0.00;-0.00;0.0', aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat), 0);
vatAmtDr:=vatAmtDr+StrToFloatDef(FormatFloat('0.00;-0.00;0.0', aQuery.fieldByName('<27><><EFBFBD><EFBFBD>˰<EFBFBD><CBB0>').AsFloat),0);
end;
if t_cw_design.fieldByName('<27><><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6>ժҪ').AsString='' then
begin
Explan:=get_str(BsType,'<27><>',aQuery.fieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString,FDATASET);
end
else
begin
Explan:=getstrfromdataset(aQuery,t_cw_design.fieldByName('<27><><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6>ժҪ').AsString);
end;
if AccInfo.AccItem=1 then
dmAcc.AdotblVouItems.FieldByName('EXPLAN').AsString:=Explan+' '+aQuery.fieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString
else 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.FieldByName('QTYSPECS').AsString:=AccInfo.CustKindName; // <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>
dmAcc.AdotblVouItems.FieldByName('DEPTID').AsString:=GetDeptID(fDataSet.fieldByName('<27><><EFBFBD>۲<EFBFBD><DBB2><EFBFBD>').AsString);
dmAcc.AdotblVouItems.FieldByName('EMPLID').AsString:=GetEmpID(fDataSet.fieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString);
case t_cw_design.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsInteger of
0:
case BsType of
1,2:
begin
dmAcc.AdotblVouItems.FieldByName('BSNO').AsString:=fDataSet.fieldByName('<27><><EFBFBD><EFBFBD><E1B5A5>').AsString;
end;
3,4:
begin
dmAcc.AdotblVouItems.FieldByName('BSNO').AsString:=fDataSet.fieldByName('<27><><EFBFBD>˵<EFBFBD><CBB5><EFBFBD>').AsString;
end;
end;
1:
begin
dmAcc.AdotblVouItems.FieldByName('BSNO').AsString:=fDataSet.fieldByName('ί<>б<EFBFBD><D0B1><EFBFBD>').AsString;
end;
2:begin
dmAcc.AdotblVouItems.FieldByName('BSNO').AsString:=fDataSet.fieldByName('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString;
end;
else dmAcc.AdotblVouItems.FieldByName('BSNO').AsString:=fDataSet.fieldByName('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString
end;
dmAcc.AdotblVouItems.Post;
aQuery.Next;
end;
with aQuery,SQL do
begin
Close;sql.Clear;
Add('SELECT t_ch_fee.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>,t_crm_Client.<2E>ͻ<EFBFBD>ȫ<EFBFBD><C8AB>,t_ch_fee.<2E><><EFBFBD><EFBFBD>,t_ch_fee.<2E>ұ<EFBFBD>,t_ch_fee.<2E>Ƿ<EFBFBD><C7B7>渶');
Add(',V_op_bscard_All.ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,V_op_bscard_All.ί<>б<EFBFBD><D0B1><EFBFBD>,V_op_bscard_All.<2E><><EFBFBD><EFBFBD><E1B5A5>,V_op_bscard_All.<2E><><EFBFBD><EFBFBD>,V_op_bscard_All.<2E><><EFBFBD><EFBFBD>');
if AccInfo.AccItem=1 then
Add(',t_Code_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
Add(',SUM(t_ch_fee.<2E><><EFBFBD><EFBFBD>) AS <20><><EFBFBD><EFBFBD>,SUM(t_ch_fee.<2E><><EFBFBD><EFBFBD>*t_ch_fee.<2E><><EFBFBD><EFBFBD>) AS <20>ϼƽ<CFBC><C6BD><EFBFBD>,SUM(t_ch_fee.<2E><><EFBFBD>񲻺<EFBFBD>˰<EFBFBD><CBB0>) AS <20><><EFBFBD><EFBFBD>˰<EFBFBD><CBB0>');
Add('From t_ch_fee');
if AccInfo.AccItem=1 then
Add('Left Join t_Code_fee on t_ch_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>=t_Code_fee.<2E><><EFBFBD><EFBFBD><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('Left Join V_op_bscard_All on t_ch_fee.<2E><><EFBFBD><EFBFBD>=V_op_bscard_All.<2E><><EFBFBD><EFBFBD>');
Add('WHERE t_ch_fee. <20><><EFBFBD><EFBFBD>=:<3A><><EFBFBD><EFBFBD> and t_ch_fee.<2E><><EFBFBD><EFBFBD> in ('+BillNos+')');
Add('GROUP BY t_ch_fee.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>,t_crm_Client.<2E>ͻ<EFBFBD>ȫ<EFBFBD><C8AB>,t_ch_fee.<2E><><EFBFBD><EFBFBD>,t_ch_fee.<2E>ұ<EFBFBD>,t_ch_fee.<2E>Ƿ<EFBFBD><C7B7>渶');
Add(',V_op_bscard_All.ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,V_op_bscard_All.ί<>б<EFBFBD><D0B1><EFBFBD>,V_op_bscard_All.<2E><><EFBFBD><EFBFBD><E1B5A5>,V_op_bscard_All.<2E><><EFBFBD><EFBFBD>,V_op_bscard_All.<2E><><EFBFBD><EFBFBD>');
if AccInfo.AccItem=1 then
Add(',t_Code_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
Add('ORDER BY t_ch_fee.<2E>ұ<EFBFBD> DESC,t_ch_fee.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>');
if AccInfo.AccItem=1 then
Add(',t_Code_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ');
Parameters.ParamByName('<27><><EFBFBD><EFBFBD>').Value:='<27><>';
Open;
end;
Result:=dmAcc.AdotblVou.fieldByName('VOUNO').AsString;
aQuery.First;
while not aQuery.Eof do
begin
dmAcc.AdotblVouItems.Insert;
if t_cw_design.FieldByName('ƾ֤<C6BE><D6A4>ֹ<EFBFBD>޸<EFBFBD>').AsBoolean then
dmAcc.AdotblVouItems.FieldByName('CF').AsInteger:=1;
if aQuery.FieldByName('<27>ұ<EFBFBD>').AsString='USD' then
begin
if t_cw_design.fieldByName('<27><><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6>תӦ<D7AA><D3A6>').AsBoolean then
begin
if frm_data_share.t_crm_client_daili.Locate('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>',aQuery.fieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString,[]) then
begin
dmAcc.AdotblVouItems.FieldByName('QTYSPECS').AsString:=AccInfo.CustKindName; // <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>
if aQuery.fieldByName('<27>Ƿ<EFBFBD><C7B7>渶').AsBoolean then
dmAcc.AdotblVouItems.FieldByName('AccID').AsString:=AccInfo.OtherCreditAccID
else dmAcc.AdotblVouItems.FieldByName('AccID').AsString:=AccInfo.DebitAccIDU;
end
else
begin
dmAcc.AdotblVouItems.FieldByName('QTYSPECS').AsString:=AccInfo.SuppKindName; // <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>
if aQuery.fieldByName('<27>Ƿ<EFBFBD><C7B7>渶').AsBoolean then
dmAcc.AdotblVouItems.FieldByName('AccID').AsString:=AccInfo.OtherCreditAccID
else dmAcc.AdotblVouItems.FieldByName('AccID').AsString:=AccInfo.CreditAccIDU;
end;
end
else
begin
dmAcc.AdotblVouItems.FieldByName('QTYSPECS').AsString:=AccInfo.SuppKindName; // <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>
if aQuery.fieldByName('<27>Ƿ<EFBFBD><C7B7>渶').AsBoolean then
dmAcc.AdotblVouItems.FieldByName('AccID').AsString:=AccInfo.OtherCreditAccID
else dmAcc.AdotblVouItems.FieldByName('AccID').AsString:=AccInfo.CreditAccIDU;
end;
if bsSkinCheckRadioBox7.Checked then
dmAcc.AdotblVouItems.FieldByName('FCYEXRATE').AsFloat:=aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat
else
dmAcc.AdotblVouItems.FieldByName('FCYEXRATE').AsFloat:=UsdExRate;
dmAcc.AdotblVouItems.FieldByName('FCYCR').AsFloat:=StrToFloatDef(FormatFloat('0.00;-0.00;0.0',aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat),0);
USDCr:=USDCr+dmAcc.AdotblVouItems.FieldByName('FCYCR').AsFloat;
dmAcc.AdotblVouItems.FieldByName('FCYDr').AsFloat:=0.0;
if bsSkinCheckRadioBox7.Checked then
begin
dmAcc.AdotblVouItems.FieldByName('AmtCr').AsFloat:=StrToFloatDef(FormatFloat('0.00;-0.00;0.0',
StrToFloat(FloatToStr(aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat*aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat))), 0);
if not aQuery.fieldByName('<27>Ƿ<EFBFBD><C7B7>渶').AsBoolean then
UTORCr:=UTORCr+dmAcc.AdotblVouItems.FieldByName('AmtCr').AsFloat;
vatAmtCr:=vatAmtCr+StrToFloatDef(FormatFloat('0.00;-0.00;0.0',
StrToFloat(FloatToStr(aQuery.fieldByName('<27><><EFBFBD><EFBFBD>˰<EFBFBD><CBB0>').AsFloat*aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat))), 0);
end
else
begin
dmAcc.AdotblVouItems.FieldByName('AmtCr').AsFloat:=StrToFloatDef(FormatFloat('0.00;-0.00;0.0',StrToFloat(FloatToStr(aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat*UsdExRate))), 0);
if not aQuery.fieldByName('<27>Ƿ<EFBFBD><C7B7>渶').AsBoolean then
UTORCr:=UTORCr+dmAcc.AdotblVouItems.FieldByName('AmtCr').AsFloat;
vatAmtCr:=vatAmtCr+StrToFloatDef(FormatFloat('0.00;-0.00;0.0',StrToFloat(FloatToStr(aQuery.fieldByName('<27><><EFBFBD><EFBFBD>˰<EFBFBD><CBB0>').AsFloat*UsdExRate))), 0);
end;
dmAcc.AdotblVouItems.FieldByName('AmtDr').AsFloat:=0.0;
dmAcc.AdotblVouItems.FieldByName('FCYNO').AsString:='USD';
end
else
begin
if t_cw_design.fieldByName('<27><><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6>תӦ<D7AA><D3A6>').AsBoolean then
begin
if frm_data_share.t_crm_client_daili.Locate('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>',aQuery.fieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString,[]) then
begin
dmAcc.AdotblVouItems.FieldByName('QTYSPECS').AsString:=AccInfo.CustKindName; // <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>
if aQuery.fieldByName('<27>Ƿ<EFBFBD><C7B7>渶').AsBoolean then
dmAcc.AdotblVouItems.FieldByName('AccID').AsString:=AccInfo.OtherCreditAccID
else dmAcc.AdotblVouItems.FieldByName('AccID').AsString:=AccInfo.DebitAccID;
end
else
begin
dmAcc.AdotblVouItems.FieldByName('QTYSPECS').AsString:=AccInfo.SuppKindName; // <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>
if aQuery.fieldByName('<27>Ƿ<EFBFBD><C7B7>渶').AsBoolean then
dmAcc.AdotblVouItems.FieldByName('AccID').AsString:=AccInfo.OtherCreditAccID
else dmAcc.AdotblVouItems.FieldByName('AccID').AsString:=AccInfo.CreditAccID;
end;
end
else
begin
dmAcc.AdotblVouItems.FieldByName('QTYSPECS').AsString:=AccInfo.SuppKindName; // <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>
if aQuery.fieldByName('<27>Ƿ<EFBFBD><C7B7>渶').AsBoolean then
dmAcc.AdotblVouItems.FieldByName('AccID').AsString:=AccInfo.OtherCreditAccID
else dmAcc.AdotblVouItems.FieldByName('AccID').AsString:=AccInfo.CreditAccID;
end;
dmAcc.AdotblVouItems.FieldByName('AmtCr').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('FCYDR').AsFloat:=0.0;
dmAcc.AdotblVouItems.FieldByName('FCYCr').AsFloat:=0.0;
dmAcc.AdotblVouItems.FieldByName('FCYEXRATE').AsFloat:=0.0;
dmAcc.AdotblVouItems.FieldByName('FCYNO').AsString:='RMB';
if not aQuery.fieldByName('<27>Ƿ<EFBFBD><C7B7>渶').AsBoolean then
Cr:=CR+StrToFloatDef(FormatFloat('0.00;-0.00;0.0', aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat), 0);
vatAmtCr:=vatAmtCr+StrToFloatDef(FormatFloat('0.00;-0.00;0.0', aQuery.fieldByName('<27><><EFBFBD><EFBFBD>˰<EFBFBD><CBB0>').AsFloat),0);
end;
if t_cw_design.fieldByName('<27><><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6>תӦ<D7AA><D3A6>').AsBoolean then
begin
if frm_data_share.t_crm_client_daili.Locate('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>',aQuery.fieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString,[]) then
begin
if t_cw_design.fieldByName('<27><><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6>ժҪ').AsString='' then
begin
Explan:=get_str(BsType,'<27><>',aQuery.fieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString,FDATASET);
end
else
begin
Explan:=getstrfromdataset(aQuery,t_cw_design.fieldByName('<27><><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6>ժҪ').AsString);
end;
end
else
begin
if t_cw_design.fieldByName('<27><><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6>ժҪ').AsString='' then
begin
Explan:=get_str(BsType,'<27><>',aQuery.fieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString,FDATASET);
end
else
begin
Explan:=getstrfromdataset(aQuery,t_cw_design.fieldByName('<27><><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6>ժҪ').AsString);
end;
end;
end
else
begin
if t_cw_design.fieldByName('<27><><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6>ժҪ').AsString='' then
begin
Explan:=get_str(BsType,'<27><>',aQuery.fieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString,FDATASET);
end
else
begin
Explan:=getstrfromdataset(aQuery,t_cw_design.fieldByName('<27><><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6>ժҪ').AsString);
end;
end;
if AccInfo.AccItem=1 then
dmAcc.AdotblVouItems.FieldByName('EXPLAN').AsString:=Explan+' '+aQuery.fieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString
else 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.FieldByName('DEPTID').AsString:=GetDeptID(fDataSet.fieldByName('<27><><EFBFBD>۲<EFBFBD><DBB2><EFBFBD>').AsString);
dmAcc.AdotblVouItems.FieldByName('EMPLID').AsString:=GetEmpID(fDataSet.fieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString);
case t_cw_design.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsInteger of
0:
case BsType of
1,2:dmAcc.AdotblVouItems.FieldByName('BSNO').AsString:=fDataSet.fieldByName('<27><><EFBFBD><EFBFBD><E1B5A5>').AsString;
3,4:dmAcc.AdotblVouItems.FieldByName('BSNO').AsString:=fDataSet.fieldByName('<27><><EFBFBD>˵<EFBFBD><CBB5><EFBFBD>').AsString;
end;
1:dmAcc.AdotblVouItems.FieldByName('BSNO').AsString:=fDataSet.fieldByName('ί<>б<EFBFBD><D0B1><EFBFBD>').AsString;
2:dmAcc.AdotblVouItems.FieldByName('BSNO').AsString:=fDataSet.fieldByName('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString
else dmAcc.AdotblVouItems.FieldByName('BSNO').AsString:=fDataSet.fieldByName('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString
end;
dmAcc.AdotblVouItems.Post;
aQuery.Next;
end;
case t_cw_design.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsInteger of
0:
case BsType of
1,2:mblno:=fDataSet.fieldByName('<27><><EFBFBD><EFBFBD><E1B5A5>').AsString;
3,4:mblno:=fDataSet.fieldByName('<27><><EFBFBD>˵<EFBFBD><CBB5><EFBFBD>').AsString;
end;
1:mblno:=fDataSet.fieldByName('ί<>б<EFBFBD><D0B1><EFBFBD>').AsString;
2:mblno:=fDataSet.fieldByName('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString
else mblno:=fDataSet.fieldByName('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString
end;
corps:=fDataSet.fieldByName('ί<>е<EFBFBD>λ').AsString;
Depts:=fDataSet.fieldByName('<27><><EFBFBD>۲<EFBFBD><DBB2><EFBFBD>').AsString;
sales:=fDataSet.fieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString;
sTrade:=fDataSet.fieldByName('<27><><EFBFBD><EFBFBD>').AsString;
explan:=get_strProfit(BsType,fDataSet);
IncomeCost(fDataSet,explan,mblno,corps,Depts,sales,AccInfo.ProfitFull,AccInfo.ICUSD,Dr,Cr,USDDr,USDCr,UTORDr,UTORCr,vatAmtDr,vatAmtCr,sTrade);
dmAcc.AdotblVou.Post;
finally
FreeAndNil(aQuery);
FreeAndNil(aQuery2);
end;
end;
function Tfrm_cw_pingzheng_gj.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(Edit10.Text,7.8);
amtvat:=0.00;
Explan:='';
with aQuery,SQL do
begin
if t_cw_design.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>ƾ֤').asboolean then
begin
Close;Clear;
Add('Select s.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,s.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>,s.<2E>ո<EFBFBD>,s.<2E>ұ<EFBFBD>,s.<2E><><EFBFBD><EFBFBD>,s.<2E>Ƿ<EFBFBD><C7B7>渶');
Add(',sum(S.<2E><><EFBFBD><EFBFBD>) <20><><EFBFBD><EFBFBD>,sum(S.<2E><><EFBFBD><EFBFBD>*s.<2E><><EFBFBD><EFBFBD>) <20>ϼƽ<CFBC><C6BD><EFBFBD>');
Add('from v_fee_balance_items s');
Add('where S.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>='''+fDataSet.fieldbyName('<27>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>').AsString+'''');
Add('Group By s.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,s.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>,s.<2E>ո<EFBFBD>,s.<2E>ұ<EFBFBD> ,s.<2E><><EFBFBD><EFBFBD>,s.<2E>Ƿ<EFBFBD><C7B7>渶');
Add('Order By s.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,s.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>,s.<2E>ո<EFBFBD>,s.<2E>ұ<EFBFBD> ,s.<2E><><EFBFBD><EFBFBD>,s.<2E>Ƿ<EFBFBD><C7B7>渶');
end
else
begin
Close;Clear;
Add('Select s.ί<>б<EFBFBD><D0B1><EFBFBD>,s.ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,s.<2E><><EFBFBD><EFBFBD><E1B5A5>,s.ί<>е<EFBFBD>λ,s.<2E><><EFBFBD>۲<EFBFBD><DBB2><EFBFBD>,s.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,s.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>,s.<2E>ո<EFBFBD>,s.<2E>ұ<EFBFBD>,s.<2E><><EFBFBD><EFBFBD>,S.<2E><><EFBFBD><EFBFBD>,s.<2E><><EFBFBD><EFBFBD>,s.<2E>Ƿ<EFBFBD><C7B7>渶');
if AccInfo.AccItem=1 then
Add(',f.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
Add(',sum(S.<2E><><EFBFBD><EFBFBD>) <20><><EFBFBD><EFBFBD>,sum(S.<2E><><EFBFBD><EFBFBD>*s.<2E><><EFBFBD><EFBFBD>) <20>ϼƽ<CFBC><C6BD><EFBFBD>');
Add('from v_fee_balance_items s');
if AccInfo.AccItem=1 then
Add('Left Join t_Code_fee f on s.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>=f.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
Add('where S.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>='''+fDataSet.fieldbyName('<27>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>').AsString+'''');
Add('Group By s.ί<>б<EFBFBD><D0B1><EFBFBD>,s.ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,s.<2E><><EFBFBD><EFBFBD><E1B5A5>,s.ί<>е<EFBFBD>λ,s.<2E><><EFBFBD>۲<EFBFBD><DBB2><EFBFBD>,s.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,s.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>,s.<2E>ո<EFBFBD>,s.<2E>ұ<EFBFBD> ,s.<2E><><EFBFBD><EFBFBD>,S.<2E><><EFBFBD><EFBFBD>,s.<2E><><EFBFBD><EFBFBD>,s.<2E>Ƿ<EFBFBD><C7B7>渶');
if AccInfo.AccItem=1 then
Add(',f.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
Add('Order By s.ί<>б<EFBFBD><D0B1><EFBFBD>,s.ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,s.<2E><><EFBFBD><EFBFBD><E1B5A5>,s.ί<>е<EFBFBD>λ,s.<2E><><EFBFBD>۲<EFBFBD><DBB2><EFBFBD>,s.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,s.<2E>ұ<EFBFBD> DESC,s.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>,s.<2E>ո<EFBFBD>,s.<2E><><EFBFBD><EFBFBD>,S.<2E><><EFBFBD><EFBFBD>,s.<2E><><EFBFBD><EFBFBD>');
if AccInfo.AccItem=1 then
Add(',f.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
end;
Open;
end;
aQuery.First;
while not aQuery.Eof do
begin
if aQuery.FieldByName('<27>ո<EFBFBD>').AsString='<27><>' then
begin
if aQuery.FieldByName('<27>ұ<EFBFBD>').AsString='USD' then
begin
if bsSkinCheckRadioBox7.Checked then
begin
StlUSDAmtCR:=StlUSDAmtCR+StrToFloatDef(FormatFloat('0.00;-0.00;0.0', StrToFloat(FloatToStr(aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat*aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat))), 0)
end
else
begin
StlUSDAmtCR:=StlUSDAmtCR+StrToFloatDef(FormatFloat('0.00;-0.00;0.0', StrToFloat(FloatToStr(aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat*UsdExRate))), 0);
end;
end
else
begin
StlAmtCR:=StlAmtCR+StrToFloatDef(FormatFloat('0.00;-0.00;0.0', aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat), 0);
end;
end
else
begin
if aQuery.FieldByName('<27>ұ<EFBFBD>').AsString='USD' then
begin
if bsSkinCheckRadioBox7.Checked then
StlUSDAmtDR:=StlUSDAmtDR+StrToFloatDef(FormatFloat('0.00;-0.00;0.0', StrToFloat(FloatToStr(aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat*aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat))), 0)
else
StlUSDAmtDR:=StlUSDAmtDR+StrToFloatDef(FormatFloat('0.00;-0.00;0.0', StrToFloat(FloatToStr(aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat*UsdExRate))), 0);
end
else
begin
StlAmtDR:=StlAmtDR+StrToFloatDef(FormatFloat('0.00;-0.00;0.0', aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat), 0);
end;
end;
aQuery.next;
end;
with aQuery,SQL do
begin
if t_cw_design.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>ƾ֤').asboolean then
begin
Close;Clear;
Add('Select s.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,s.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>,s.<2E>ո<EFBFBD>,s.ԭʼ<D4AD>ұ<EFBFBD> <20>ұ<EFBFBD>,s.<2E><><EFBFBD><EFBFBD>,s.<2E>Ƿ<EFBFBD><C7B7>渶');
Add(',sum(S.ԭʼ<D4AD><CABC><EFBFBD><EFBFBD>) <20><><EFBFBD><EFBFBD>,sum(S.ԭʼ<D4AD><CABC><EFBFBD><EFBFBD>*s.<2E><><EFBFBD><EFBFBD>) <20>ϼƽ<CFBC><C6BD><EFBFBD>');
Add('from v_fee_balance_items s');
Add('where S.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>='''+fDataSet.fieldbyName('<27>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>').AsString+'''');
Add('Group By s.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,s.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>,s.<2E>ո<EFBFBD>,s.ԭʼ<D4AD>ұ<EFBFBD>,s.<2E><><EFBFBD><EFBFBD>,s.<2E>Ƿ<EFBFBD><C7B7>渶');
Add('Order By s.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,s.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>,s.<2E>ո<EFBFBD>,s.ԭʼ<D4AD>ұ<EFBFBD>,s.<2E><><EFBFBD><EFBFBD>,s.<2E>Ƿ<EFBFBD><C7B7>渶');
end
else
begin
Close;Clear;
Add('Select s.ί<>б<EFBFBD><D0B1><EFBFBD>,s.ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,s.<2E><><EFBFBD><EFBFBD><E1B5A5>,s.ί<>е<EFBFBD>λ,s.<2E><><EFBFBD>۲<EFBFBD><DBB2><EFBFBD>,s.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,s.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>,t_crm_client.<2E>ͻ<EFBFBD>ȫ<EFBFBD><C8AB>,s.<2E>ո<EFBFBD>,s.ԭʼ<D4AD>ұ<EFBFBD> <20>ұ<EFBFBD>,s.<2E><><EFBFBD><EFBFBD>,S.<2E><><EFBFBD><EFBFBD>,s.<2E><><EFBFBD><EFBFBD>,s.<2E>Ƿ<EFBFBD><C7B7>渶');
if AccInfo.AccItem=1 then
Add(',f.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
Add(',sum(S.ԭʼ<D4AD><CABC><EFBFBD><EFBFBD>) <20><><EFBFBD><EFBFBD>,sum(S.ԭʼ<D4AD><CABC><EFBFBD><EFBFBD>*s.<2E><><EFBFBD><EFBFBD>) <20>ϼƽ<CFBC><C6BD><EFBFBD>');
Add('from v_fee_balance_items s');
if AccInfo.AccItem=1 then
Add('Left Join t_Code_fee f on s.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>=f.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
Add('Left Join t_crm_client on s.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>=t_crm_client.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>');
Add('where S.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>='''+fDataSet.fieldbyName('<27>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>').AsString+'''');
Add('Group By s.ί<>б<EFBFBD><D0B1><EFBFBD>,s.ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,s.<2E><><EFBFBD><EFBFBD><E1B5A5>,s.ί<>е<EFBFBD>λ,s.<2E><><EFBFBD>۲<EFBFBD><DBB2><EFBFBD>,s.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,s.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>,t_crm_client.<2E>ͻ<EFBFBD>ȫ<EFBFBD><C8AB>,s.<2E>ո<EFBFBD>,s.ԭʼ<D4AD>ұ<EFBFBD> ,s.<2E><><EFBFBD><EFBFBD>,S.<2E><><EFBFBD><EFBFBD>,s.<2E><><EFBFBD><EFBFBD>,s.<2E>Ƿ<EFBFBD><C7B7>渶');
if AccInfo.AccItem=1 then
Add(',f.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
Add('Order By s.ί<>б<EFBFBD><D0B1><EFBFBD>,s.ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,s.<2E><><EFBFBD><EFBFBD><E1B5A5>,s.ί<>е<EFBFBD>λ,s.<2E><><EFBFBD>۲<EFBFBD><DBB2><EFBFBD>,s.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,s.<2E>ұ<EFBFBD> DESC,s.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>,s.<2E>ո<EFBFBD>,s.<2E><><EFBFBD><EFBFBD>,S.<2E><><EFBFBD><EFBFBD>,s.<2E><><EFBFBD><EFBFBD>');
if AccInfo.AccItem=1 then
Add(',f.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
end;
Open;
end;
aQuery.First;
OrdNo:=dmAcc.AdotblVou.fieldByName('OrdNo').AsInteger;
dmAcc.AdotblVouItems.Open;
while not aQuery.Eof do
begin
dmAcc.AdotblVouItems.Insert;
if aQuery.FieldByName('<27>ո<EFBFBD>').AsString='<27><>' then
begin
dmAcc.AdotblVouItems.FieldByName('QTYSPECS').AsString:=AccInfo.SuppKindName;
if aQuery.FieldByName('<27>ұ<EFBFBD>').AsString='USD' then
begin
if t_cw_design.fieldByName('<27><><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6>תӦ<D7AA><D3A6>').AsBoolean then
begin
if frm_data_share.t_crm_client_daili.Locate('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>',aQuery.fieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString,[]) then
begin
dmAcc.AdotblVouItems.FieldByName('QTYSPECS').AsString:=AccInfo.CustKindName;
if aQuery.fieldByName('<27>Ƿ<EFBFBD><C7B7>渶').AsBoolean then
dmAcc.AdotblVouItems.FieldByName('AccID').AsString:=AccInfo.OtherCreditAccID
else dmAcc.AdotblVouItems.FieldByName('AccID').AsString:=AccInfo.DebitAccIDU;
end
else
begin
dmAcc.AdotblVouItems.FieldByName('QTYSPECS').AsString:=AccInfo.SuppKindName;
if aQuery.fieldByName('<27>Ƿ<EFBFBD><C7B7>渶').AsBoolean then
dmAcc.AdotblVouItems.FieldByName('AccID').AsString:=AccInfo.OtherCreditAccID
else dmAcc.AdotblVouItems.FieldByName('AccID').AsString:=AccInfo.CreditAccIDU;
end;
end
else
begin
dmAcc.AdotblVouItems.FieldByName('QTYSPECS').AsString:=AccInfo.SuppKindName;
if aQuery.fieldByName('<27>Ƿ<EFBFBD><C7B7>渶').AsBoolean then
dmAcc.AdotblVouItems.FieldByName('AccID').AsString:=AccInfo.OtherCreditAccID
else dmAcc.AdotblVouItems.FieldByName('AccID').AsString:=AccInfo.CreditAccIDU;
end;
if bsSkinCheckRadioBox7.Checked then
dmAcc.AdotblVouItems.FieldByName('FCYEXRATE').AsFloat:=aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat
else
dmAcc.AdotblVouItems.FieldByName('FCYEXRATE').AsFloat:=UsdExRate;
dmAcc.AdotblVouItems.FieldByName('FCYCR').AsFloat:=0.0;
dmAcc.AdotblVouItems.FieldByName('FCYDr').AsFloat:=StrToFloatDef(FormatFloat('0.00;-0.00;0.0',aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat),0);
dmAcc.AdotblVouItems.FieldByName('AmtCr').AsFloat:=0.0;
if bsSkinCheckRadioBox7.Checked then
dmAcc.AdotblVouItems.FieldByName('AmtDr').AsFloat:=StrToFloatDef(FormatFloat('0.00;-0.00;0.0', StrToFloat(FloatToStr(aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat*aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat))), 0)
else
dmAcc.AdotblVouItems.FieldByName('AmtDr').AsFloat:=StrToFloatDef(FormatFloat('0.00;-0.00;0.0', StrToFloat(FloatToStr(aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat*UsdExRate))), 0);
if bsSkinCheckRadioBox7.Checked then
begin
USDAmtCR:=USDAmtCR+StrToFloatDef(FormatFloat('0.00;-0.00;0.0', StrToFloat(FloatToStr(aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat*aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat))), 0)
end
else
begin
USDAmtCR:=USDAmtCR+StrToFloatDef(FormatFloat('0.00;-0.00;0.0', StrToFloat(FloatToStr(aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat*UsdExRate))), 0);
end;
end
else
begin
if t_cw_design.fieldByName('<27><><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6>תӦ<D7AA><D3A6>').AsBoolean then
begin
if frm_data_share.t_crm_client_daili.Locate('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>',aQuery.fieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString,[]) then
begin
dmAcc.AdotblVouItems.FieldByName('QTYSPECS').AsString:=AccInfo.CustKindName;
if aQuery.fieldByName('<27>Ƿ<EFBFBD><C7B7>渶').AsBoolean then
dmAcc.AdotblVouItems.FieldByName('AccID').AsString:=AccInfo.OtherCreditAccID
else dmAcc.AdotblVouItems.FieldByName('AccID').AsString:=AccInfo.DebitAccID;
end
else
begin
dmAcc.AdotblVouItems.FieldByName('QTYSPECS').AsString:=AccInfo.SuppKindName;
if aQuery.fieldByName('<27>Ƿ<EFBFBD><C7B7>渶').AsBoolean then
dmAcc.AdotblVouItems.FieldByName('AccID').AsString:=AccInfo.OtherCreditAccID
else dmAcc.AdotblVouItems.FieldByName('AccID').AsString:=AccInfo.CreditAccID;
end;
end
else
begin
dmAcc.AdotblVouItems.FieldByName('QTYSPECS').AsString:=AccInfo.SuppKindName;
if aQuery.fieldByName('<27>Ƿ<EFBFBD><C7B7>渶').AsBoolean then
dmAcc.AdotblVouItems.FieldByName('AccID').AsString:=AccInfo.OtherCreditAccID
else dmAcc.AdotblVouItems.FieldByName('AccID').AsString:=AccInfo.CreditAccID;
end;
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;
AmtCR:=AmtCR+StrToFloatDef(FormatFloat('0.00;-0.00;0.0', aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat), 0);
end;
end
else
begin
dmAcc.AdotblVouItems.FieldByName('QTYSPECS').AsString:=AccInfo.CustKindName;
if aQuery.FieldByName('<27>ұ<EFBFBD>').AsString='USD' then
begin
if aQuery.fieldByName('<27>Ƿ<EFBFBD><C7B7>渶').AsBoolean then
dmAcc.AdotblVouItems.FieldByName('AccID').AsString:=AccInfo.OtherDebitAccID
else dmAcc.AdotblVouItems.FieldByName('AccID').AsString:=AccInfo.DebitAccIDU;
if bsSkinCheckRadioBox7.Checked then
dmAcc.AdotblVouItems.FieldByName('FCYEXRATE').AsFloat:=aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat
else
dmAcc.AdotblVouItems.FieldByName('FCYEXRATE').AsFloat:=UsdExRate;
dmAcc.AdotblVouItems.FieldByName('FCYDR').AsFloat:=0.00;
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.00;
if bsSkinCheckRadioBox7.Checked then
dmAcc.AdotblVouItems.FieldByName('AmtCr').AsFloat:=StrToFloatDef(FormatFloat('0.00;-0.00;0.0', StrToFloat(FloatToStr(aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat*aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat))), 0)
else
dmAcc.AdotblVouItems.FieldByName('AmtCr').AsFloat:=StrToFloatDef(FormatFloat('0.00;-0.00;0.0', StrToFloat(FloatToStr(aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat*UsdExRate))), 0);
if bsSkinCheckRadioBox7.Checked then
USDAmtDR:=USDAmtDR+StrToFloatDef(FormatFloat('0.00;-0.00;0.0', StrToFloat(FloatToStr(aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat*aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat))), 0)
else
USDAmtDR:=USDAmtDR+StrToFloatDef(FormatFloat('0.00;-0.00;0.0', StrToFloat(FloatToStr(aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat*UsdExRate))), 0);
end else begin
if aQuery.fieldByName('<27>Ƿ<EFBFBD><C7B7>渶').AsBoolean then
dmAcc.AdotblVouItems.FieldByName('AccID').AsString:=AccInfo.OtherDebitAccID
else dmAcc.AdotblVouItems.FieldByName('AccID').AsString:=AccInfo.DebitAccID;
dmAcc.AdotblVouItems.FieldByName('AmtDr').AsFloat:=0.00;
dmAcc.AdotblVouItems.FieldByName('AmtCr').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;
AmtDR:=AmtDR+StrToFloatDef(FormatFloat('0.00;-0.00;0.0', aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat), 0);
end;
end;
if aQuery.FieldByName('<27>ո<EFBFBD>').AsString='<27><>' then
begin
if t_cw_design.fieldByName('<27><><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6>תӦ<D7AA><D3A6>').AsBoolean then
begin
if frm_data_share.t_crm_client_daili.Locate('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>',aQuery.fieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString,[]) then
begin
Explan:='';
if not t_cw_design.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>ƾ֤').asboolean then
begin
if AccInfo.AccItem=1 then
Explan:=get_strDc(aQuery)
else Explan:=get_strDc(aQuery);
end;
if t_cw_design.fieldByName('<27><><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5>ժҪ').AsString<>'' then
begin
Explan:=getstrfromdataset(aQuery,t_cw_design.fieldByName('<27><><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5>ժҪ').AsString);
end;
end
else
begin
Explan:='';
if not t_cw_design.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>ƾ֤').asboolean then
begin
if AccInfo.AccItem=1 then
Explan:=get_strDc(aQuery)
else Explan:=get_strDc(aQuery);
end;
if t_cw_design.fieldByName('<27><><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5>ժҪ').AsString<>'' then
begin
Explan:=getstrfromdataset(aQuery,t_cw_design.fieldByName('<27><><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5>ժҪ').AsString);
end;
end;
end
else
begin
Explan:='';
if not t_cw_design.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>ƾ֤').asboolean then
begin
if AccInfo.AccItem=1 then
Explan:=get_strDc(aQuery)
else Explan:=get_strDc(aQuery);
end;
if t_cw_design.fieldByName('<27><><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5>ժҪ').AsString<>'' then
begin
Explan:=getstrfromdataset(aQuery,t_cw_design.fieldByName('<27><><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5>ժҪ').AsString);
end;
end;
end
else
begin
Explan:='';
if not t_cw_design.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>ƾ֤').asboolean then
begin
if AccInfo.AccItem=1 then
Explan:=get_strDc(aQuery)
else Explan:=get_strDc(aQuery);
end;
if t_cw_design.fieldByName('<27><><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5>ժҪ').AsString<>'' then
begin
Explan:=getstrfromdataset(aQuery,t_cw_design.fieldByName('<27><><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5>ժҪ').AsString);
end;
end;
if not t_cw_design.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>ƾ֤').asboolean then
begin
if AccInfo.AccItem=1 then
dmAcc.AdotblVouItems.FieldByName('EXPLAN').AsString:=Explan+' '+aQuery.fieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString
else dmAcc.AdotblVouItems.FieldByName('EXPLAN').AsString:=Explan;
end
else
begin
dmAcc.AdotblVouItems.FieldByName('EXPLAN').AsString:=aQuery.fieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString +' '+aQuery.fieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString+' '+get_billStr(fDataSet.fieldByName('<27>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>').AsString);
end;
dmAcc.AdotblVouItems.FieldByName('CorpID').AsString:=GetCustID(aQuery.fieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString,aQuery.fieldbyname('<27>ո<EFBFBD>').AsString);
dmAcc.AdotblVouItems.FieldByName('CorpBf').AsString:='F';
if not t_cw_design.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>ƾ֤').asboolean then
begin
dmAcc.AdotblVouItems.FieldByName('DEPTID').AsString:=GetDeptID(aQuery.fieldByName('<27><><EFBFBD>۲<EFBFBD><DBB2><EFBFBD>').AsString);
dmAcc.AdotblVouItems.FieldByName('EMPLID').AsString:=GetEmpID(aQuery.fieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString);
end;
if not t_cw_design.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>ƾ֤').asboolean then
begin
case t_cw_design.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsInteger of
0:dmAcc.AdotblVouItems.FieldByName('BSNO').AsString:=aQuery.fieldByName('<27><><EFBFBD><EFBFBD><E1B5A5>').AsString;
1:dmAcc.AdotblVouItems.FieldByName('BSNO').AsString:=aQuery.fieldByName('ί<>б<EFBFBD><D0B1><EFBFBD>').AsString;
2:dmAcc.AdotblVouItems.FieldByName('BSNO').AsString:=aQuery.fieldByName('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString
else dmAcc.AdotblVouItems.FieldByName('BSNO').AsString:=aQuery.fieldByName('<27><><EFBFBD><EFBFBD><E1B5A5>').AsString;
end;
end
else
dmAcc.AdotblVouItems.FieldByName('BSNO').AsString:=aQuery.fieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString;
dmAcc.AdotblVouItems.Post;
if not t_cw_design.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>ƾ֤').asboolean then
MBlNo:=aQuery.fieldByName('<27><><EFBFBD><EFBFBD><E1B5A5>').AsString
else
MBlNo:=aQuery.fieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString;
aQuery.next;
end;
if (fDataSet.FieldByName('<27><>Ԫ<EFBFBD><D4AA><EFBFBD><EFBFBD>').Asfloat<>0) or (fDataSet.FieldByName('<27>ұ<EFBFBD>').AsString='USD') then
begin
dmAcc.AdotblVouItems.Insert;
dmAcc.AdotblVouItems.FieldByName('AccID').AsString:=GetbankAccid(fdataSet,'USD');
if fdataset.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring='<27><>' then
begin
if StrToBool(get_parameters_value(83,'false')) then
begin
if fDataSet.FieldByName('<27>ұ<EFBFBD>').AsString='USD' then
dmAcc.AdotblVouItems.FieldByName('FCYDR').AsFloat:=StrToFloatDef(FormatFloat('0.00;-0.00;0.0',fdataset.fieldbyname('<27><>Ԫ<EFBFBD><D4AA><EFBFBD><EFBFBD>').asfloat),0)
else dmAcc.AdotblVouItems.FieldByName('FCYDR').AsFloat:=StrToFloatDef(FormatFloat('0.00;-0.00;0.0',fdataset.fieldbyname('<27><>Ԫ<EFBFBD><D4AA><EFBFBD><EFBFBD>').asfloat),0);
end
else
begin
if fDataSet.FieldByName('<27>ұ<EFBFBD>').AsString='USD' then
dmAcc.AdotblVouItems.FieldByName('FCYDR').AsFloat:=StrToFloatDef(FormatFloat('0.00;-0.00;0.0',fdataset.fieldbyname('ʵ<><CAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asfloat),0)
else dmAcc.AdotblVouItems.FieldByName('FCYDR').AsFloat:=StrToFloatDef(FormatFloat('0.00;-0.00;0.0',fdataset.fieldbyname('<27><>Ԫ<EFBFBD><D4AA><EFBFBD><EFBFBD>').asfloat),0);
end;
dmAcc.AdotblVouItems.FieldByName('FCYCr').AsFloat:=0.0;
if bsSkinCheckRadioBox7.Checked then
dmAcc.AdotblVouItems.FieldByName('FCYEXRATE').AsFloat:=aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat
else
dmAcc.AdotblVouItems.FieldByName('FCYEXRATE').AsFloat:=UsdExRate;
dmAcc.AdotblVouItems.FieldByName('AmtCr').AsFloat:=0.0;
dmAcc.AdotblVouItems.FieldByName('AmtDR').AsFloat:=StlUSDAmtDR-StlUSDAmtCR;
amtvat:=amtvat+StlUSDAmtDR-StlUSDAmtCR;
end else begin
dmAcc.AdotblVouItems.FieldByName('FCYDR').AsFloat:=0.00;
if StrToBool(get_parameters_value(83,'false')) then
begin
if fDataSet.FieldByName('<27>ұ<EFBFBD>').AsString='USD' then
dmAcc.AdotblVouItems.FieldByName('FCYCR').AsFloat:=StrToFloatDef(FormatFloat('0.00;-0.00;0.0',fdataset.fieldbyname('<27><>Ԫ<EFBFBD><D4AA><EFBFBD><EFBFBD>').asfloat),0)
else dmAcc.AdotblVouItems.FieldByName('FCYCR').AsFloat:=StrToFloatDef(FormatFloat('0.00;-0.00;0.0',fdataset.fieldbyname('<27><>Ԫ<EFBFBD><D4AA><EFBFBD><EFBFBD>').asfloat),0);
end
else
begin
if fDataSet.FieldByName('<27>ұ<EFBFBD>').AsString='USD' then
dmAcc.AdotblVouItems.FieldByName('FCYCR').AsFloat:=StrToFloatDef(FormatFloat('0.00;-0.00;0.0',fdataset.fieldbyname('ʵ<><CAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asfloat),0)
else dmAcc.AdotblVouItems.FieldByName('FCYCR').AsFloat:=StrToFloatDef(FormatFloat('0.00;-0.00;0.0',fdataset.fieldbyname('<27><>Ԫ<EFBFBD><D4AA><EFBFBD><EFBFBD>').asfloat),0);
end;
if bsSkinCheckRadioBox7.Checked then
dmAcc.AdotblVouItems.FieldByName('FCYEXRATE').AsFloat:=aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat
else
dmAcc.AdotblVouItems.FieldByName('FCYEXRATE').AsFloat:=UsdExRate;
dmAcc.AdotblVouItems.FieldByName('AmtCr').AsFloat:=StlUSDAmtCR-StlUSDAmtDR;
dmAcc.AdotblVouItems.FieldByName('AmtDR').AsFloat:=0.00;
amtvat:=amtvat+StlUSDAmtCR-StlUSDAmtDR;
end;
dmAcc.AdotblVouItems.FieldByName('FSETTLCODE').AsString:=fdataset.fieldbyname('<27><><EFBFBD>ʽ').asstring;
if strtobool(get_parameters_value(83,'false')) then
dmAcc.AdotblVouItems.FieldByName('FSETTLENO').AsString:=Trim(fdataset.fieldbyname('<27><>Ԫ<EFBFBD><D4AA><EFBFBD>غ<EFBFBD><D8BA><EFBFBD>').asstring)
else dmAcc.AdotblVouItems.FieldByName('FSETTLENO').AsString:=Trim(fdataset.fieldbyname('<27><><EFBFBD>غ<EFBFBD><D8BA><EFBFBD>').asstring);
dmAcc.AdotblVouItems.FieldByName('CorpID').AsString:=GetCustID(aQuery.fieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString,aQuery.fieldbyname('<27>ո<EFBFBD>').AsString);
if fDataSet.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString='<27><>' then
begin
Explan:='';
if not t_cw_design.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>ƾ֤').asboolean then
begin
if t_cw_design.fieldbyname('<27>ո<EFBFBD><D5B8><EFBFBD><EFBFBD><EFBFBD><E1B5A5>').asboolean then
Explan:=get_strDc(aQuery)+' '+MBlNo
else Explan:=get_strDc(aQuery);
end
else
begin
Explan:=MBlNo+' '+get_billStr(fDataSet.fieldByName('<27>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>').AsString);
end;
if t_cw_design.fieldByName('<27><><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5>ժҪ').AsString<>'' then
begin
Explan:=getstrfromdataset(aQuery,t_cw_design.fieldByName('<27><><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5>ժҪ').AsString);
end;
end
else
begin
Explan:='';
if not t_cw_design.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>ƾ֤').asboolean then
begin
if t_cw_design.fieldbyname('<27>ո<EFBFBD><D5B8><EFBFBD><EFBFBD><EFBFBD><E1B5A5>').asboolean then
Explan:=get_strDc(aQuery)+' '+MBlNo
else Explan:=get_strDc(aQuery);
end
else
begin
Explan:=MBlNo+' '+get_billStr(fDataSet.fieldByName('<27>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>').AsString);
end;
if t_cw_design.fieldByName('<27><><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5>ժҪ').AsString<>'' then
begin
Explan:=getstrfromdataset(aQuery,t_cw_design.fieldByName('<27><><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5>ժҪ').AsString)
+'('+fdataset.fieldbyname('<27><><EFBFBD>ʽ').asstring+'-'+Trim(fdataset.fieldbyname('<27><><EFBFBD>غ<EFBFBD><D8BA><EFBFBD>').asstring)+')';
end;
end;
if not t_cw_design.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>ƾ֤').asboolean then
begin
if t_cw_design.fieldbyname('<27>ո<EFBFBD><D5B8><EFBFBD><EFBFBD><EFBFBD><E1B5A5>').asboolean then
dmAcc.AdotblVouItems.FieldByName('EXPLAN').AsString:=Explan
else dmAcc.AdotblVouItems.FieldByName('EXPLAN').AsString:=Explan
end
else
begin
dmAcc.AdotblVouItems.FieldByName('EXPLAN').AsString:=MBlNo+' '+get_billStr(fDataSet.fieldByName('<27>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>').AsString);
end;
dmAcc.AdotblVouItems.post;
end;
if (fDataSet.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD>ҽ<EFBFBD><D2BD><EFBFBD>').Asfloat<>0) or (fDataSet.FieldByName('<27>ұ<EFBFBD>').AsString='RMB') then
begin
dmAcc.AdotblVouItems.Insert;
dmAcc.AdotblVouItems.FieldByName('AccID').AsString:=GetbankAccid(fDataSet,'RMB');
if fdataset.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring='<27><>' then begin
dmAcc.AdotblVouItems.FieldByName('FCYDR').AsFloat:=0.0;
dmAcc.AdotblVouItems.FieldByName('FCYCr').AsFloat:=0.0;
dmAcc.AdotblVouItems.FieldByName('FCYEXRATE').AsFloat:=0.0;
dmAcc.AdotblVouItems.FieldByName('AmtCr').AsFloat:=0.0;
dmAcc.AdotblVouItems.FieldByName('AmtDR').AsFloat:=StlAmtDR-StlAmtCR;
amtvat:=amtvat+StlAmtDR-StlAmtCR;
end else begin
dmAcc.AdotblVouItems.FieldByName('FCYDR').AsFloat:=0.00;
dmAcc.AdotblVouItems.FieldByName('FCYCr').AsFloat:=0.00;
dmAcc.AdotblVouItems.FieldByName('FCYEXRATE').AsFloat:=0.00;
dmAcc.AdotblVouItems.FieldByName('AmtCr').AsFloat:=StlAmtCR-StlAmtDR;
dmAcc.AdotblVouItems.FieldByName('AmtDR').AsFloat:=0.00;
amtvat:=amtvat+StlAmtCR-StlAmtDR;
end;
dmAcc.AdotblVouItems.FieldByName('FSETTLCODE').AsString:=fdataset.fieldbyname('<27><><EFBFBD>ʽ').asstring;
dmAcc.AdotblVouItems.FieldByName('FSETTLENO').AsString:=Trim(fdataset.fieldbyname('<27><><EFBFBD>غ<EFBFBD><D8BA><EFBFBD>').asstring);
dmAcc.AdotblVouItems.FieldByName('CorpID').AsString:=GetCustID(aQuery.fieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString,aQuery.fieldbyname('<27>ո<EFBFBD>').AsString);
if fDataSet.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString='<27><>' then
begin
Explan:='';
if not t_cw_design.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>ƾ֤').asboolean then
begin
if t_cw_design.fieldbyname('<27>ո<EFBFBD><D5B8><EFBFBD><EFBFBD><EFBFBD><E1B5A5>').asboolean then
Explan:=get_strDc(aQuery)+' '+MBlNo
else Explan:=get_strDc(aQuery);
end
else
begin
Explan:=MBlNo+' '+get_billStr(fDataSet.fieldByName('<27>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>').AsString);
end;
if t_cw_design.fieldByName('<27><><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5>ժҪ').AsString<>'' then
begin
Explan:=getstrfromdataset(aQuery,t_cw_design.fieldByName('<27><><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5>ժҪ').AsString);
end;
end
else
begin
Explan:='';
if not t_cw_design.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>ƾ֤').asboolean then
begin
if t_cw_design.fieldbyname('<27>ո<EFBFBD><D5B8><EFBFBD><EFBFBD><EFBFBD><E1B5A5>').asboolean then
Explan:=get_strDc(aQuery)+' '+MBlNo
else Explan:=get_strDc(aQuery);
end
else
begin
Explan:=MBlNo+' '+get_billStr(fDataSet.fieldByName('<27>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>').AsString);
end;
if t_cw_design.fieldByName('<27><><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5>ժҪ').AsString<>'' then
begin
Explan:=getstrfromdataset(aQuery,t_cw_design.fieldByName('<27><><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5>ժҪ').AsString)
+'('+fdataset.fieldbyname('<27><><EFBFBD>ʽ').asstring+'-'+Trim(fdataset.fieldbyname('<27><><EFBFBD>غ<EFBFBD><D8BA><EFBFBD>').asstring)+')';
end;
end;
if not t_cw_design.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>ƾ֤').asboolean then
begin
if t_cw_design.fieldbyname('<27>ո<EFBFBD><D5B8><EFBFBD><EFBFBD><EFBFBD><E1B5A5>').asboolean then
dmAcc.AdotblVouItems.FieldByName('EXPLAN').AsString:=Explan
else dmAcc.AdotblVouItems.FieldByName('EXPLAN').AsString:=Explan
end
else
begin
dmAcc.AdotblVouItems.FieldByName('EXPLAN').AsString:=MBlNo+' '+get_billStr(fDataSet.fieldByName('<27>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>').AsString);
end;
dmAcc.AdotblVouItems.FieldByName('BSNO').AsString:=fDataSet.fieldbyName('<27>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>').AsString;
dmAcc.AdotblVouItems.post;
end;
//StlAmtDR+StlUSDAmtDR ʵ<><CAB5>
//AmtDR-USDAmtDR Ӧ<><D3A6>
// ShowMessage('Ӧ<><D3A6>'+FloatToStr(AmtDR+USDAmtDR)+'ʵ<><CAB5>'+FloatToStr(StlAmtDR+StlUSDAmtDR)+' <20><>'+FloatToStr(AmtDR+USDAmtDR-StlAmtDR-StlUSDAmtDR));
if StrToFloat(FormatFloat('0.00;-0.00;0',StlAmtDR+StlUSDAmtDR-AmtDR-USDAmtDR))<>0 then
begin
dmAcc.AdotblVouItems.Insert;
dmAcc.AdotblVouItems.FieldByName('AccID').AsString:=AccInfo.ExchangeGLID;
dmAcc.AdotblVouItems.FieldByName('FCYDR').AsFloat:=0.00;
dmAcc.AdotblVouItems.FieldByName('FCYCr').AsFloat:=0.00;
dmAcc.AdotblVouItems.FieldByName('FCYEXRATE').AsFloat:=0.00;
dmAcc.AdotblVouItems.FieldByName('AmtCr').AsFloat:=StlAmtDR+StlUSDAmtDR-AmtDR-USDAmtDR;
dmAcc.AdotblVouItems.FieldByName('AmtDR').AsFloat:=0.00;
dmAcc.AdotblVouItems.FieldByName('EXPLAN').AsString:=MBlNo+' '+get_billStr(fDataSet.fieldByName('<27>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>').AsString);
dmAcc.AdotblVouItems.FieldByName('BSNO').AsString:=fDataSet.fieldbyName('<27>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>').AsString;
dmAcc.AdotblVouItems.post;
end;
//StlAmtDR+StlUSDAmtCR ʵ<><CAB5>
//AmtCR-USDAmtCR Ӧ<><D3A6>
if StrToFloat(FormatFloat('0.00;-0.00;0',StlAmtCR+StlUSDAmtCR-AmtCR-USDAmtCR))<>0 then
begin
dmAcc.AdotblVouItems.Insert;
dmAcc.AdotblVouItems.FieldByName('AccID').AsString:=AccInfo.ExchangeGLID;
dmAcc.AdotblVouItems.FieldByName('FCYDR').AsFloat:=0.00;
dmAcc.AdotblVouItems.FieldByName('FCYCr').AsFloat:=0.00;
dmAcc.AdotblVouItems.FieldByName('FCYEXRATE').AsFloat:=0.00;
dmAcc.AdotblVouItems.FieldByName('AmtCr').AsFloat:=AmtCR+USDAmtCR-StlAmtCR-StlUSDAmtCR;
dmAcc.AdotblVouItems.FieldByName('AmtDR').AsFloat:=0.00;
dmAcc.AdotblVouItems.FieldByName('EXPLAN').AsString:=MBlNo+' '+get_billStr(fDataSet.fieldByName('<27>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>').AsString);
dmAcc.AdotblVouItems.FieldByName('BSNO').AsString:=fDataSet.fieldbyName('<27>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>').AsString;
dmAcc.AdotblVouItems.post;
end;
if AccInfo.ifPreTaxes and AccInfo.ifvat then
begin
amtvat:=amtvat/(1+frm_data_share.t_sys_company.fieldbyname('˰<><CBB0>').AsFloat/100)*frm_data_share.t_sys_company.fieldbyname('˰<><CBB0>').AsFloat/100;
amtvat:=StrToFloatDef(FormatFloat('0.00;-0.00;0.0',amtvat),0);
if fDataSet.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString='<27><>' then
begin
dmAcc.AdotblVouItems.Insert;
dmAcc.AdotblVouItems.FieldByName('AccID').AsString:=AccInfo.PreTaxes_Income;
dmAcc.AdotblVouItems.FieldByName('FCYDR').AsFloat:=0.00;
dmAcc.AdotblVouItems.FieldByName('FCYCr').AsFloat:=0.00;
dmAcc.AdotblVouItems.FieldByName('FCYEXRATE').AsFloat:=0;
dmAcc.AdotblVouItems.FieldByName('AmtCr').AsFloat:=0-amtvat;
dmAcc.AdotblVouItems.FieldByName('AmtDR').AsFloat:=0.00;
dmAcc.AdotblVouItems.FieldByName('EXPLAN').AsString:=MBlNo+' '+get_billStr(fDataSet.fieldByName('<27>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>').AsString);
dmAcc.AdotblVouItems.FieldByName('BSNO').AsString:=fDataSet.fieldbyName('<27>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>').AsString;
dmAcc.AdotblVouItems.post;
dmAcc.AdotblVouItems.Insert;
dmAcc.AdotblVouItems.FieldByName('AccID').AsString:=AccInfo.Taxes_Income;
dmAcc.AdotblVouItems.FieldByName('FCYDR').AsFloat:=0.00;
dmAcc.AdotblVouItems.FieldByName('FCYCr').AsFloat:=0.00;
dmAcc.AdotblVouItems.FieldByName('FCYEXRATE').AsFloat:=0;
dmAcc.AdotblVouItems.FieldByName('AmtCr').AsFloat:=amtvat;
dmAcc.AdotblVouItems.FieldByName('AmtDR').AsFloat:=0.00;
dmAcc.AdotblVouItems.FieldByName('EXPLAN').AsString:=MBlNo+' '+get_billStr(fDataSet.fieldByName('<27>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>').AsString);
dmAcc.AdotblVouItems.FieldByName('BSNO').AsString:=fDataSet.fieldbyName('<27>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>').AsString;
dmAcc.AdotblVouItems.post;
end
else
begin
dmAcc.AdotblVouItems.Insert;
dmAcc.AdotblVouItems.FieldByName('AccID').AsString:=AccInfo.PreTaxes_Cost;
dmAcc.AdotblVouItems.FieldByName('FCYDR').AsFloat:=0.00;
dmAcc.AdotblVouItems.FieldByName('FCYCr').AsFloat:=0.00;
dmAcc.AdotblVouItems.FieldByName('FCYEXRATE').AsFloat:=0;
dmAcc.AdotblVouItems.FieldByName('AmtDr').AsFloat:=0-amtvat;
dmAcc.AdotblVouItems.FieldByName('AmtCR').AsFloat:=0.00;
dmAcc.AdotblVouItems.FieldByName('EXPLAN').AsString:=MBlNo+' '+get_billStr(fDataSet.fieldByName('<27>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>').AsString);
dmAcc.AdotblVouItems.FieldByName('BSNO').AsString:=fDataSet.fieldbyName('<27>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>').AsString;
dmAcc.AdotblVouItems.post;
dmAcc.AdotblVouItems.Insert;
dmAcc.AdotblVouItems.FieldByName('AccID').AsString:=AccInfo.Taxes_Cost;
dmAcc.AdotblVouItems.FieldByName('FCYDR').AsFloat:=0.00;
dmAcc.AdotblVouItems.FieldByName('FCYCr').AsFloat:=0.00;
dmAcc.AdotblVouItems.FieldByName('FCYEXRATE').AsFloat:=0;
dmAcc.AdotblVouItems.FieldByName('AmtDr').AsFloat:=amtvat;
dmAcc.AdotblVouItems.FieldByName('AmtCR').AsFloat:=0.00;
dmAcc.AdotblVouItems.FieldByName('EXPLAN').AsString:=MBlNo+' '+get_billStr(fDataSet.fieldByName('<27>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>').AsString);
dmAcc.AdotblVouItems.FieldByName('BSNO').AsString:=fDataSet.fieldbyName('<27>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>').AsString;
dmAcc.AdotblVouItems.post;
end;
end;
// amtvat
FreeAndNil(aQuery);
end;
function Tfrm_cw_pingzheng_gj.NewDCVou(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,wtbsnos,Explan:string;
begin
Result:=false;
aQuery:=CreateADOQuery;
aQuery2:=CreateADOQuery;
StlAmtDR:=0.00;
StlAmtCR:=0.00;
StlUSDAmtDR:=0.00;
StlUSDAmtCR:=0.00;
amtvat:=0;
dmAcc.AdotblVou.Insert;
dmAcc.AdotblVou.FieldByName('SourceType').AsInteger:=2;
dmAcc.AdotblVou.FieldByName('ATTACHS').AsInteger:=AccInfo.ATTACHS;
if Trim(t_op_balance.FieldByName('<27><><EFBFBD><EFBFBD>').AsString)='<27><>' then
begin
if Trim(t_cw_design.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD>տ<EFBFBD>ƾ֤<C6BE><D6A4>').AsString)<>'' then
begin
dmAcc.AdotblVou.FieldByName('VKNO').AsString:=Trim(t_cw_design.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD>տ<EFBFBD>ƾ֤<C6BE><D6A4>').AsString);
end
else dmAcc.AdotblVou.FieldByName('VKNO').AsString:='<27><>';
end
else
begin
if Trim(t_cw_design.FieldByName('<27><><EFBFBD>и<EFBFBD><D0B8><EFBFBD>ƾ֤<C6BE><D6A4>').AsString)<>'' then
begin
dmAcc.AdotblVou.FieldByName('VKNO').AsString:=Trim(t_cw_design.FieldByName('<27><><EFBFBD>и<EFBFBD><D0B8><EFBFBD>ƾ֤<C6BE><D6A4>').AsString);
end
else dmAcc.AdotblVou.FieldByName('VKNO').AsString:='<27><>';
end;
dmAcc.AdotblVou.FieldByName('PREPARED').AsString:=RxDBLookupCombo6.DisplayValues[0];
dmAcc.AdotblVou.Post;
dmAcc.AdotblVou.Edit;
UsdExRate:=StrToFloatDef(Edit10.Text,7.8);
with aQuery,SQL do
begin
if t_cw_design.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>ƾ֤').asboolean then
begin
if (t_cw_design.fieldbyname('<27>ո<EFBFBD><D5B8><EFBFBD><EFBFBD><EFBFBD>').asboolean) and (t_cw_design.fieldbyname('<27>ո<EFBFBD><D5B8><EFBFBD><EFBFBD><EFBFBD>').asboolean) then
begin
Close;Clear;
Add('Select s.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,s.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>,s.<2E>ո<EFBFBD>,s.<2E>ұ<EFBFBD>,s.<2E><><EFBFBD><EFBFBD>,s.<2E>Ƿ<EFBFBD><C7B7>渶,S.<2E><><EFBFBD><EFBFBD>,s.<2E><><EFBFBD><EFBFBD>');
Add(',sum(S.<2E><><EFBFBD><EFBFBD>) <20><><EFBFBD><EFBFBD>,sum(S.<2E><><EFBFBD><EFBFBD>*s.<2E><><EFBFBD><EFBFBD>) <20>ϼƽ<CFBC><C6BD><EFBFBD>');
Add('from v_fee_balance_items s');
Add('where S.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>='''+fDataSet.fieldbyName('<27>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>').AsString+'''');
Add('Group By s.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,s.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>,s.<2E>ո<EFBFBD>,s.<2E>ұ<EFBFBD> ,s.<2E><><EFBFBD><EFBFBD>,s.<2E>Ƿ<EFBFBD><C7B7>渶,S.<2E><><EFBFBD><EFBFBD>,s.<2E><><EFBFBD><EFBFBD>');
Add('Order By s.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,s.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>,s.<2E>ո<EFBFBD>,s.<2E>ұ<EFBFBD> ,s.<2E><><EFBFBD><EFBFBD>,s.<2E>Ƿ<EFBFBD><C7B7>渶,S.<2E><><EFBFBD><EFBFBD>,s.<2E><><EFBFBD><EFBFBD>');
end
else
begin
Close;Clear;
Add('Select s.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,s.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>,s.<2E>ո<EFBFBD>,s.<2E>ұ<EFBFBD>,s.<2E><><EFBFBD><EFBFBD>,s.<2E>Ƿ<EFBFBD><C7B7>渶');
Add(',sum(S.<2E><><EFBFBD><EFBFBD>) <20><><EFBFBD><EFBFBD>,sum(S.<2E><><EFBFBD><EFBFBD>*s.<2E><><EFBFBD><EFBFBD>) <20>ϼƽ<CFBC><C6BD><EFBFBD>');
Add('from v_fee_balance_items s');
Add('where S.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>='''+fDataSet.fieldbyName('<27>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>').AsString+'''');
Add('Group By s.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,s.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>,s.<2E>ո<EFBFBD>,s.<2E>ұ<EFBFBD> ,s.<2E><><EFBFBD><EFBFBD>,s.<2E>Ƿ<EFBFBD><C7B7>渶');
Add('Order By s.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,s.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>,s.<2E>ո<EFBFBD>,s.<2E>ұ<EFBFBD> ,s.<2E><><EFBFBD><EFBFBD>,s.<2E>Ƿ<EFBFBD><C7B7>渶');
end;
end
else
begin
Close;Clear;
Add('Select s.ί<>б<EFBFBD><D0B1><EFBFBD>,s.ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,s.<2E><><EFBFBD><EFBFBD><E1B5A5>,s.ί<>е<EFBFBD>λ,s.<2E><><EFBFBD>۲<EFBFBD><DBB2><EFBFBD>,s.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,s.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>,t_crm_client.<2E>ͻ<EFBFBD>ȫ<EFBFBD><C8AB>,s.<2E>ո<EFBFBD>,s.<2E>ұ<EFBFBD>,s.<2E><><EFBFBD><EFBFBD>,S.<2E><><EFBFBD><EFBFBD>,s.<2E><><EFBFBD><EFBFBD>,s.<2E>Ƿ<EFBFBD><C7B7>渶');
if AccInfo.AccItem=1 then
Add(',f.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
Add(',sum(S.<2E><><EFBFBD><EFBFBD>) <20><><EFBFBD><EFBFBD>,sum(S.<2E><><EFBFBD><EFBFBD>*s.<2E><><EFBFBD><EFBFBD>) <20>ϼƽ<CFBC><C6BD><EFBFBD>');
Add('from v_fee_balance_items s');
if AccInfo.AccItem=1 then
Add('Left Join t_Code_fee f on s.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>=f.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
Add('Left Join t_crm_client on s.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>=t_crm_client.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>');
Add('where S.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>='''+fDataSet.fieldbyName('<27>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>').AsString+'''');
Add('Group By s.ί<>б<EFBFBD><D0B1><EFBFBD>,s.ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,s.<2E><><EFBFBD><EFBFBD><E1B5A5>,s.ί<>е<EFBFBD>λ,s.<2E><><EFBFBD>۲<EFBFBD><DBB2><EFBFBD>,s.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,s.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>,t_crm_client.<2E>ͻ<EFBFBD>ȫ<EFBFBD><C8AB>,s.<2E>ո<EFBFBD>,s.<2E>ұ<EFBFBD> ,s.<2E><><EFBFBD><EFBFBD>,S.<2E><><EFBFBD><EFBFBD>,s.<2E><><EFBFBD><EFBFBD>,s.<2E>Ƿ<EFBFBD><C7B7>渶');
if AccInfo.AccItem=1 then
Add(',f.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
Add('Order By s.ί<>б<EFBFBD><D0B1><EFBFBD>,s.ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,s.<2E><><EFBFBD><EFBFBD><E1B5A5>,s.ί<>е<EFBFBD>λ,s.<2E><><EFBFBD>۲<EFBFBD><DBB2><EFBFBD>,s.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,s.<2E>ұ<EFBFBD> DESC,s.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>,s.<2E>ո<EFBFBD>,s.<2E><><EFBFBD><EFBFBD>,S.<2E><><EFBFBD><EFBFBD>,s.<2E><><EFBFBD><EFBFBD>');
if AccInfo.AccItem=1 then
Add(',f.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
end;
Open;
end;
aQuery.First;
while not aQuery.Eof do
begin
if aQuery.FieldByName('<27>ո<EFBFBD>').AsString='<27><>' then
begin
if aQuery.FieldByName('<27>ұ<EFBFBD>').AsString='USD' then
begin
if bsSkinCheckRadioBox7.Checked then
begin
StlUSDAmtCR:=StlUSDAmtCR+StrToFloatDef(FormatFloat('0.00;-0.00;0.0', StrToFloat(FloatToStr(aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat*aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat))), 0)
end
else
begin
StlUSDAmtCR:=StlUSDAmtCR+StrToFloatDef(FormatFloat('0.00;-0.00;0.0', StrToFloat(FloatToStr(aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat*UsdExRate))), 0);
end;
end
else
begin
StlAmtCR:=StlAmtCR+StrToFloatDef(FormatFloat('0.00;-0.00;0.0', aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat), 0);
end;
end
else
begin
if aQuery.FieldByName('<27>ұ<EFBFBD>').AsString='USD' then
begin
if bsSkinCheckRadioBox7.Checked then
StlUSDAmtDR:=StlUSDAmtDR+StrToFloatDef(FormatFloat('0.00;-0.00;0.0', StrToFloat(FloatToStr(aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat*aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat))), 0)
else
StlUSDAmtDR:=StlUSDAmtDR+StrToFloatDef(FormatFloat('0.00;-0.00;0.0', StrToFloat(FloatToStr(aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat*UsdExRate))), 0);
end
else
begin
StlAmtDR:=StlAmtDR+StrToFloatDef(FormatFloat('0.00;-0.00;0.0', aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat), 0);
end;
end;
aQuery.next;
end;
with aQuery,SQL do
begin
if t_cw_design.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>ƾ֤').asboolean then
begin
if (t_cw_design.fieldbyname('<27>ո<EFBFBD><D5B8><EFBFBD><EFBFBD><EFBFBD>').asboolean) and (t_cw_design.fieldbyname('<27>ո<EFBFBD><D5B8><EFBFBD><EFBFBD><EFBFBD>').asboolean) then
begin
Close;Clear;
Add('Select s.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,s.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>,s.<2E>ո<EFBFBD>,s.ԭʼ<D4AD>ұ<EFBFBD> <20>ұ<EFBFBD>,s.<2E><><EFBFBD><EFBFBD>,s.<2E>Ƿ<EFBFBD><C7B7>渶,S.<2E><><EFBFBD><EFBFBD>,s.<2E><><EFBFBD><EFBFBD>');
Add(',sum(S.ԭʼ<D4AD><CABC><EFBFBD><EFBFBD>) <20><><EFBFBD><EFBFBD>,sum(S.ԭʼ<D4AD><CABC><EFBFBD><EFBFBD>*s.<2E><><EFBFBD><EFBFBD>) <20>ϼƽ<CFBC><C6BD><EFBFBD>');
Add('from v_fee_balance_items s');
Add('where S.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>='''+fDataSet.fieldbyName('<27>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>').AsString+'''');
Add('Group By s.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,s.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>,s.<2E>ո<EFBFBD>,s.ԭʼ<D4AD>ұ<EFBFBD>,s.<2E><><EFBFBD><EFBFBD>,s.<2E>Ƿ<EFBFBD><C7B7>渶,S.<2E><><EFBFBD><EFBFBD>,s.<2E><><EFBFBD><EFBFBD>');
Add('Order By s.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,s.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>,s.<2E>ո<EFBFBD>,s.ԭʼ<D4AD>ұ<EFBFBD>,s.<2E><><EFBFBD><EFBFBD>,s.<2E>Ƿ<EFBFBD><C7B7>渶,S.<2E><><EFBFBD><EFBFBD>,s.<2E><><EFBFBD><EFBFBD>');
end
else
begin
Close;Clear;
Add('Select s.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,s.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>,s.<2E>ո<EFBFBD>,s.ԭʼ<D4AD>ұ<EFBFBD> <20>ұ<EFBFBD>,s.<2E><><EFBFBD><EFBFBD>,s.<2E>Ƿ<EFBFBD><C7B7>渶');
Add(',sum(S.ԭʼ<D4AD><CABC><EFBFBD><EFBFBD>) <20><><EFBFBD><EFBFBD>,sum(S.ԭʼ<D4AD><CABC><EFBFBD><EFBFBD>*s.<2E><><EFBFBD><EFBFBD>) <20>ϼƽ<CFBC><C6BD><EFBFBD>');
Add('from v_fee_balance_items s');
Add('where S.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>='''+fDataSet.fieldbyName('<27>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>').AsString+'''');
Add('Group By s.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,s.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>,s.<2E>ո<EFBFBD>,s.ԭʼ<D4AD>ұ<EFBFBD>,s.<2E><><EFBFBD><EFBFBD>,s.<2E>Ƿ<EFBFBD><C7B7>渶');
Add('Order By s.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,s.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>,s.<2E>ո<EFBFBD>,s.ԭʼ<D4AD>ұ<EFBFBD>,s.<2E><><EFBFBD><EFBFBD>,s.<2E>Ƿ<EFBFBD><C7B7>渶');
end;
end
else
begin
Close;Clear;
Add('Select s.ί<>б<EFBFBD><D0B1><EFBFBD>,s.ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,s.<2E><><EFBFBD><EFBFBD><E1B5A5>,s.ί<>е<EFBFBD>λ,s.<2E><><EFBFBD>۲<EFBFBD><DBB2><EFBFBD>,s.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,s.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>,t_crm_client.<2E>ͻ<EFBFBD>ȫ<EFBFBD><C8AB>,s.<2E>ո<EFBFBD>,s.ԭʼ<D4AD>ұ<EFBFBD> <20>ұ<EFBFBD>,s.<2E><><EFBFBD><EFBFBD>,S.<2E><><EFBFBD><EFBFBD>,s.<2E><><EFBFBD><EFBFBD>,s.<2E>Ƿ<EFBFBD><C7B7>渶');
if AccInfo.AccItem=1 then
Add(',f.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
Add(',sum(S.ԭʼ<D4AD><CABC><EFBFBD><EFBFBD>) <20><><EFBFBD><EFBFBD>,sum(S.ԭʼ<D4AD><CABC><EFBFBD><EFBFBD>*s.<2E><><EFBFBD><EFBFBD>) <20>ϼƽ<CFBC><C6BD><EFBFBD>');
Add('from v_fee_balance_items s');
if AccInfo.AccItem=1 then
Add('Left Join t_Code_fee f on s.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>=f.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
Add('Left Join t_crm_client on s.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>=t_crm_client.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>');
Add('where S.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>='''+fDataSet.fieldbyName('<27>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>').AsString+'''');
Add('Group By s.ί<>б<EFBFBD><D0B1><EFBFBD>,s.ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,s.<2E><><EFBFBD><EFBFBD><E1B5A5>,s.ί<>е<EFBFBD>λ,s.<2E><><EFBFBD>۲<EFBFBD><DBB2><EFBFBD>,s.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,s.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>,t_crm_client.<2E>ͻ<EFBFBD>ȫ<EFBFBD><C8AB>,s.<2E>ո<EFBFBD>,s.ԭʼ<D4AD>ұ<EFBFBD> ,s.<2E><><EFBFBD><EFBFBD>,S.<2E><><EFBFBD><EFBFBD>,s.<2E><><EFBFBD><EFBFBD>,s.<2E>Ƿ<EFBFBD><C7B7>渶');
if AccInfo.AccItem=1 then
Add(',f.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
Add('Order By s.ί<>б<EFBFBD><D0B1><EFBFBD>,s.ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,s.<2E><><EFBFBD><EFBFBD><E1B5A5>,s.ί<>е<EFBFBD>λ,s.<2E><><EFBFBD>۲<EFBFBD><DBB2><EFBFBD>,s.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,s.<2E>ұ<EFBFBD> DESC,s.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>,s.<2E>ո<EFBFBD>,s.<2E><><EFBFBD><EFBFBD>,S.<2E><><EFBFBD><EFBFBD>,s.<2E><><EFBFBD><EFBFBD>');
if AccInfo.AccItem=1 then
Add(',f.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
end;
Open;
end;
aQuery.First;
OrdNo:=dmAcc.AdotblVou.fieldByName('OrdNo').AsInteger;
dmAcc.AdotblVouItems.Open;
while not aQuery.Eof do
begin
dmAcc.AdotblVouItems.Insert;
if aQuery.FieldByName('<27>ո<EFBFBD>').AsString='<27><>' then
begin
dmAcc.AdotblVouItems.FieldByName('QTYSPECS').AsString:=AccInfo.SuppKindName;
if aQuery.FieldByName('<27>ұ<EFBFBD>').AsString='USD' then
begin
if aQuery.fieldByName('<27>Ƿ<EFBFBD><C7B7>渶').AsBoolean then
dmAcc.AdotblVouItems.FieldByName('AccID').AsString:=AccInfo.OtherCreditAccID
else dmAcc.AdotblVouItems.FieldByName('AccID').AsString:=AccInfo.CreditAccIDU;
if bsSkinCheckRadioBox7.Checked then
dmAcc.AdotblVouItems.FieldByName('FCYEXRATE').AsFloat:=aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat
else
dmAcc.AdotblVouItems.FieldByName('FCYEXRATE').AsFloat:=UsdExRate;
dmAcc.AdotblVouItems.FieldByName('FCYCR').AsFloat:=0.0;
dmAcc.AdotblVouItems.FieldByName('FCYDr').AsFloat:=StrToFloatDef(FormatFloat('0.00;-0.00;0.0',aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat),0);
dmAcc.AdotblVouItems.FieldByName('AmtCr').AsFloat:=0.0;
if bsSkinCheckRadioBox7.Checked then
dmAcc.AdotblVouItems.FieldByName('AmtDr').AsFloat:=StrToFloatDef(FormatFloat('0.00;-0.00;0.0', StrToFloat(FloatToStr(aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat*aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat))), 0)
else
dmAcc.AdotblVouItems.FieldByName('AmtDr').AsFloat:=StrToFloatDef(FormatFloat('0.00;-0.00;0.0', StrToFloat(FloatToStr(aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat*UsdExRate))), 0);
if bsSkinCheckRadioBox7.Checked then
begin
USDAmtCR:=USDAmtCR+StrToFloatDef(FormatFloat('0.00;-0.00;0.0', StrToFloat(FloatToStr(aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat*aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat))), 0)
end
else
begin
USDAmtCR:=USDAmtCR+StrToFloatDef(FormatFloat('0.00;-0.00;0.0', StrToFloat(FloatToStr(aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat*UsdExRate))), 0);
end;
end
else
begin
if aQuery.fieldByName('<27>Ƿ<EFBFBD><C7B7>渶').AsBoolean then
dmAcc.AdotblVouItems.FieldByName('AccID').AsString:=AccInfo.OtherCreditAccID
else dmAcc.AdotblVouItems.FieldByName('AccID').AsString:=AccInfo.CreditAccID;
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;
AmtCR:=AmtCR+StrToFloatDef(FormatFloat('0.00;-0.00;0.0', aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat), 0);
end;
end
else
begin
dmAcc.AdotblVouItems.FieldByName('QTYSPECS').AsString:=AccInfo.CustKindName;
if aQuery.FieldByName('<27>ұ<EFBFBD>').AsString='USD' then
begin
if aQuery.fieldByName('<27>Ƿ<EFBFBD><C7B7>渶').AsBoolean then
dmAcc.AdotblVouItems.FieldByName('AccID').AsString:=AccInfo.OtherDebitAccID
else dmAcc.AdotblVouItems.FieldByName('AccID').AsString:=AccInfo.DebitAccIDU;
if bsSkinCheckRadioBox7.Checked then
dmAcc.AdotblVouItems.FieldByName('FCYEXRATE').AsFloat:=aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat
else
dmAcc.AdotblVouItems.FieldByName('FCYEXRATE').AsFloat:=UsdExRate;
dmAcc.AdotblVouItems.FieldByName('FCYDR').AsFloat:=0.00;
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.00;
if bsSkinCheckRadioBox7.Checked then
dmAcc.AdotblVouItems.FieldByName('AmtCr').AsFloat:=StrToFloatDef(FormatFloat('0.00;-0.00;0.0', StrToFloat(FloatToStr(aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat*aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat))), 0)
else
dmAcc.AdotblVouItems.FieldByName('AmtCr').AsFloat:=StrToFloatDef(FormatFloat('0.00;-0.00;0.0', StrToFloat(FloatToStr(aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat*UsdExRate))), 0);
if bsSkinCheckRadioBox7.Checked then
USDAmtDR:=USDAmtDR+StrToFloatDef(FormatFloat('0.00;-0.00;0.0', StrToFloat(FloatToStr(aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat*aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat))), 0)
else
USDAmtDR:=USDAmtDR+StrToFloatDef(FormatFloat('0.00;-0.00;0.0', StrToFloat(FloatToStr(aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat*UsdExRate))), 0);
end else begin
if aQuery.fieldByName('<27>Ƿ<EFBFBD><C7B7>渶').AsBoolean then
dmAcc.AdotblVouItems.FieldByName('AccID').AsString:=AccInfo.OtherDebitAccID
else dmAcc.AdotblVouItems.FieldByName('AccID').AsString:=AccInfo.DebitAccID;
dmAcc.AdotblVouItems.FieldByName('AmtDr').AsFloat:=0.00;
dmAcc.AdotblVouItems.FieldByName('AmtCr').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;
AmtDR:=AmtDR+StrToFloatDef(FormatFloat('0.00;-0.00;0.0', aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat), 0);
end;
end;
if fDataSet.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString='<27><>' then
begin
Explan:='';
if not t_cw_design.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>ƾ֤').asboolean then
begin
if t_cw_design.fieldbyname('<27>ո<EFBFBD><D5B8><EFBFBD><EFBFBD><EFBFBD><E1B5A5>').asboolean then
Explan:=get_strDc(aQuery)+' '+MBlNo
else Explan:=get_strDc(aQuery);
end
else
begin
Explan:=MBlNo+' '+get_billStr(fDataSet.fieldByName('<27>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>').AsString);
end;
if t_cw_design.fieldByName('<27><><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5>ժҪ').AsString<>'' then
begin
Explan:=getstrfromdataset(aQuery,t_cw_design.fieldByName('<27><><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5>ժҪ').AsString);
end;
end
else
begin
Explan:='';
if not t_cw_design.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>ƾ֤').asboolean then
begin
if t_cw_design.fieldbyname('<27>ո<EFBFBD><D5B8><EFBFBD><EFBFBD><EFBFBD><E1B5A5>').asboolean then
Explan:=get_strDc(aQuery)+' '+MBlNo
else Explan:=get_strDc(aQuery);
end
else
begin
Explan:=MBlNo+' '+get_billStr(fDataSet.fieldByName('<27>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>').AsString);
end;
if t_cw_design.fieldByName('<27><><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5>ժҪ').AsString<>'' then
begin
Explan:=getstrfromdataset(aQuery,t_cw_design.fieldByName('<27><><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5>ժҪ').AsString)
+'('+fdataset.fieldbyname('<27><><EFBFBD>ʽ').asstring+'-'+Trim(fdataset.fieldbyname('<27><><EFBFBD>غ<EFBFBD><D8BA><EFBFBD>').asstring)+')';
end;
end;
if not t_cw_design.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>ƾ֤').asboolean then
begin
if t_cw_design.fieldbyname('<27>ո<EFBFBD><D5B8><EFBFBD><EFBFBD><EFBFBD><E1B5A5>').asboolean then
dmAcc.AdotblVouItems.FieldByName('EXPLAN').AsString:=Explan
else dmAcc.AdotblVouItems.FieldByName('EXPLAN').AsString:=Explan
end
else
begin
if Trim(Explan)<>'' then
dmAcc.AdotblVouItems.FieldByName('EXPLAN').AsString:=Explan
else dmAcc.AdotblVouItems.FieldByName('EXPLAN').AsString:=MBlNo+' '+get_billStr(fDataSet.fieldByName('<27>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>').AsString)
end;
dmAcc.AdotblVouItems.FieldByName('CorpID').AsString:=GetCustID(aQuery.fieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString,aQuery.fieldbyname('<27>ո<EFBFBD>').AsString);
dmAcc.AdotblVouItems.FieldByName('CorpBf').AsString:='F';
if not t_cw_design.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>ƾ֤').asboolean then
begin
dmAcc.AdotblVouItems.FieldByName('DEPTID').AsString:=GetDeptID(aQuery.fieldByName('<27><><EFBFBD>۲<EFBFBD><DBB2><EFBFBD>').AsString);
dmAcc.AdotblVouItems.FieldByName('EMPLID').AsString:=GetEmpID(aQuery.fieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString);
end;
if t_cw_design.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>ƾ֤').asboolean then
dmAcc.AdotblVouItems.FieldByName('BSNO').AsString:=aQuery.fieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString
else
begin
case t_cw_design.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsInteger of
0:dmAcc.AdotblVouItems.FieldByName('BSNO').AsString:=aQuery.fieldByName('<27><><EFBFBD><EFBFBD><E1B5A5>').AsString;
1:dmAcc.AdotblVouItems.FieldByName('BSNO').AsString:=aQuery.fieldByName('ί<>б<EFBFBD><D0B1><EFBFBD>').AsString;
2:dmAcc.AdotblVouItems.FieldByName('BSNO').AsString:=aQuery.fieldByName('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString
else dmAcc.AdotblVouItems.FieldByName('BSNO').AsString:=aQuery.fieldByName('<27><><EFBFBD><EFBFBD><E1B5A5>').AsString;
end;
end;
dmAcc.AdotblVouItems.Post;
if t_cw_design.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>ƾ֤').asboolean then
MBlNo:=aQuery.fieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString
else
MBlNo:=aQuery.fieldByName('<27><><EFBFBD><EFBFBD><E1B5A5>').AsString;
aQuery.next;
end;
if (fDataSet.FieldByName('<27><>Ԫ<EFBFBD><D4AA><EFBFBD><EFBFBD>').Asfloat<>0) or (fDataSet.FieldByName('<27>ұ<EFBFBD>').AsString='USD') then
begin
dmAcc.AdotblVouItems.Insert;
dmAcc.AdotblVouItems.FieldByName('AccID').AsString:=GetbankAccid(fdataSet,'USD');
if fdataset.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring='<27><>' then
begin
if (StrToBool(get_parameters_value(83,'false'))) then
begin
dmAcc.AdotblVouItems.FieldByName('FCYDR').AsFloat:=StrToFloatDef(FormatFloat('0.00;-0.00;0.0',fdataset.fieldbyname('<27><>Ԫ<EFBFBD><D4AA><EFBFBD><EFBFBD>').asfloat),0);
end
else
begin
if fDataSet.FieldByName('<27>ұ<EFBFBD>').AsString='USD' then
dmAcc.AdotblVouItems.FieldByName('FCYDR').AsFloat:=StrToFloatDef(FormatFloat('0.00;-0.00;0.0',fdataset.fieldbyname('ʵ<><CAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asfloat),0)
else dmAcc.AdotblVouItems.FieldByName('FCYDR').AsFloat:=StrToFloatDef(FormatFloat('0.00;-0.00;0.0',fdataset.fieldbyname('<27><>Ԫ<EFBFBD><D4AA><EFBFBD><EFBFBD>').asfloat),0);
end;
dmAcc.AdotblVouItems.FieldByName('FCYCr').AsFloat:=0.0;
if bsSkinCheckRadioBox7.Checked then
if dmAcc.AdotblVouItems.FieldByName('FCYDR').AsFloat<>0 then
dmAcc.AdotblVouItems.FieldByName('FCYEXRATE').AsFloat:=(StlUSDAmtDR-StlUSDAmtCR)/dmAcc.AdotblVouItems.FieldByName('FCYDR').AsFloat
else dmAcc.AdotblVouItems.FieldByName('FCYEXRATE').AsFloat:=1
else
dmAcc.AdotblVouItems.FieldByName('FCYEXRATE').AsFloat:=UsdExRate;
dmAcc.AdotblVouItems.FieldByName('AmtCr').AsFloat:=0.0;
dmAcc.AdotblVouItems.FieldByName('AmtDR').AsFloat:=StlUSDAmtDR-StlUSDAmtCR;
amtvat:=amtvat+StlUSDAmtDR-StlUSDAmtCR;
end
else
begin
dmAcc.AdotblVouItems.FieldByName('FCYDR').AsFloat:=0.00;
if (StrToBool(get_parameters_value(83,'false'))) then
begin
dmAcc.AdotblVouItems.FieldByName('FCYCR').AsFloat:=StrToFloatDef(FormatFloat('0.00;-0.00;0.0',fdataset.fieldbyname('<27><>Ԫ<EFBFBD><D4AA><EFBFBD><EFBFBD>').asfloat),0);
end
else
begin
if fDataSet.FieldByName('<27>ұ<EFBFBD>').AsString='USD' then
dmAcc.AdotblVouItems.FieldByName('FCYCR').AsFloat:=StrToFloatDef(FormatFloat('0.00;-0.00;0.0',fdataset.fieldbyname('ʵ<><CAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asfloat),0)
else dmAcc.AdotblVouItems.FieldByName('FCYCR').AsFloat:=StrToFloatDef(FormatFloat('0.00;-0.00;0.0',fdataset.fieldbyname('<27><>Ԫ<EFBFBD><D4AA><EFBFBD><EFBFBD>').asfloat),0);
end;
if bsSkinCheckRadioBox7.Checked then
if dmAcc.AdotblVouItems.FieldByName('FCYCR').AsFloat<>0 then
dmAcc.AdotblVouItems.FieldByName('FCYEXRATE').AsFloat:=(StlUSDAmtCR-StlUSDAmtDR)/dmAcc.AdotblVouItems.FieldByName('FCYCR').AsFloat
else dmAcc.AdotblVouItems.FieldByName('FCYEXRATE').AsFloat:=1
else
dmAcc.AdotblVouItems.FieldByName('FCYEXRATE').AsFloat:=UsdExRate;
dmAcc.AdotblVouItems.FieldByName('AmtCr').AsFloat:=StlUSDAmtCR-StlUSDAmtDR;
dmAcc.AdotblVouItems.FieldByName('AmtDR').AsFloat:=0.00;
amtvat:=amtvat+StlUSDAmtCR-StlUSDAmtDR;
end;
dmAcc.AdotblVouItems.FieldByName('FSETTLCODE').AsString:=fdataset.fieldbyname('<27><><EFBFBD>ʽ').asstring;
if strtobool(get_parameters_value(83,'false')) then
dmAcc.AdotblVouItems.FieldByName('FSETTLENO').AsString:=Trim(fdataset.fieldbyname('<27><>Ԫ<EFBFBD><D4AA><EFBFBD>غ<EFBFBD><D8BA><EFBFBD>').asstring)
else dmAcc.AdotblVouItems.FieldByName('FSETTLENO').AsString:=Trim(fdataset.fieldbyname('<27><><EFBFBD>غ<EFBFBD><D8BA><EFBFBD>').asstring);
dmAcc.AdotblVouItems.FieldByName('CorpID').AsString:=GetCustID(aQuery.fieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString,aQuery.fieldbyname('<27>ո<EFBFBD>').AsString);
if fDataSet.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString='<27><>' then
begin
Explan:='';
if not t_cw_design.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>ƾ֤').asboolean then
begin
if t_cw_design.fieldbyname('<27>ո<EFBFBD><D5B8><EFBFBD><EFBFBD><EFBFBD><E1B5A5>').asboolean then
Explan:=get_strDc(aQuery)+' '+MBlNo
else Explan:=get_strDc(aQuery);
end
else
begin
Explan:=MBlNo+' '+get_billStr(fDataSet.fieldByName('<27>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>').AsString);
end;
if t_cw_design.fieldByName('<27><><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5>ժҪ').AsString<>'' then
begin
Explan:=getstrfromdataset(aQuery,t_cw_design.fieldByName('<27><><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5>ժҪ').AsString);
end;
end
else
begin
Explan:='';
if not t_cw_design.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>ƾ֤').asboolean then
begin
if t_cw_design.fieldbyname('<27>ո<EFBFBD><D5B8><EFBFBD><EFBFBD><EFBFBD><E1B5A5>').asboolean then
Explan:=get_strDc(aQuery)+' '+MBlNo
else Explan:=get_strDc(aQuery);
end
else
begin
Explan:=MBlNo+' '+get_billStr(fDataSet.fieldByName('<27>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>').AsString);
end;
if t_cw_design.fieldByName('<27><><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5>ժҪ').AsString<>'' then
begin
Explan:=getstrfromdataset(aQuery,t_cw_design.fieldByName('<27><><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5>ժҪ').AsString)
+'('+fdataset.fieldbyname('<27><><EFBFBD>ʽ').asstring+'-'+Trim(fdataset.fieldbyname('<27><><EFBFBD>غ<EFBFBD><D8BA><EFBFBD>').asstring)+')';
end;
end;
if not t_cw_design.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>ƾ֤').asboolean then
begin
if t_cw_design.fieldbyname('<27>ո<EFBFBD><D5B8><EFBFBD><EFBFBD><EFBFBD><E1B5A5>').asboolean then
dmAcc.AdotblVouItems.FieldByName('EXPLAN').AsString:=Explan
else dmAcc.AdotblVouItems.FieldByName('EXPLAN').AsString:=Explan
end
else
begin
if Trim(Explan)<>'' then
dmAcc.AdotblVouItems.FieldByName('EXPLAN').AsString:=Explan
else dmAcc.AdotblVouItems.FieldByName('EXPLAN').AsString:=MBlNo+' '+get_billStr(fDataSet.fieldByName('<27>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>').AsString);
end;
dmAcc.AdotblVouItems.post;
end;
if (fDataSet.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD>ҽ<EFBFBD><D2BD><EFBFBD>').Asfloat<>0) or (fDataSet.FieldByName('<27>ұ<EFBFBD>').AsString='RMB') then
begin
dmAcc.AdotblVouItems.Insert;
dmAcc.AdotblVouItems.FieldByName('AccID').AsString:=GetbankAccid(fDataSet,'RMB');
if fdataset.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring='<27><>' then
begin
dmAcc.AdotblVouItems.FieldByName('FCYDR').AsFloat:=0.0;
dmAcc.AdotblVouItems.FieldByName('FCYCr').AsFloat:=0.0;
dmAcc.AdotblVouItems.FieldByName('FCYEXRATE').AsFloat:=0.0;
dmAcc.AdotblVouItems.FieldByName('AmtCr').AsFloat:=0.0;
dmAcc.AdotblVouItems.FieldByName('AmtDR').AsFloat:=StlAmtDR-StlAmtCR;
amtvat:=amtvat+StlAmtDR-StlAmtCR;
end
else
begin
dmAcc.AdotblVouItems.FieldByName('FCYDR').AsFloat:=0.00;
dmAcc.AdotblVouItems.FieldByName('FCYCr').AsFloat:=0.00;
dmAcc.AdotblVouItems.FieldByName('FCYEXRATE').AsFloat:=0.00;
dmAcc.AdotblVouItems.FieldByName('AmtCr').AsFloat:=StlAmtCR-StlAmtDR;
dmAcc.AdotblVouItems.FieldByName('AmtDR').AsFloat:=0.00;
amtvat:=amtvat+StlAmtCR-StlAmtDR;
end;
dmAcc.AdotblVouItems.FieldByName('FSETTLCODE').AsString:=fdataset.fieldbyname('<27><><EFBFBD>ʽ').asstring;
dmAcc.AdotblVouItems.FieldByName('FSETTLENO').AsString:=Trim(fdataset.fieldbyname('<27><><EFBFBD>غ<EFBFBD><D8BA><EFBFBD>').asstring);
dmAcc.AdotblVouItems.FieldByName('CorpID').AsString:=GetCustID(aQuery.fieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString,aQuery.fieldbyname('<27>ո<EFBFBD>').AsString);
if fDataSet.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString='<27><>' then
begin
Explan:='';
if not t_cw_design.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>ƾ֤').asboolean then
begin
if t_cw_design.fieldbyname('<27>ո<EFBFBD><D5B8><EFBFBD><EFBFBD><EFBFBD><E1B5A5>').asboolean then
Explan:=get_strDc(aQuery)+' '+MBlNo
else Explan:=get_strDc(aQuery);
end
else
begin
Explan:=MBlNo+' '+get_billStr(fDataSet.fieldByName('<27>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>').AsString);
end;
if t_cw_design.fieldByName('<27><><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5>ժҪ').AsString<>'' then
begin
Explan:=getstrfromdataset(aQuery,t_cw_design.fieldByName('<27><><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5>ժҪ').AsString);
end;
end
else
begin
Explan:='';
if not t_cw_design.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>ƾ֤').asboolean then
begin
if t_cw_design.fieldbyname('<27>ո<EFBFBD><D5B8><EFBFBD><EFBFBD><EFBFBD><E1B5A5>').asboolean then
Explan:=get_strDc(aQuery)+' '+MBlNo
else Explan:=get_strDc(aQuery);
end
else
begin
Explan:=MBlNo+' '+get_billStr(fDataSet.fieldByName('<27>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>').AsString);
end;
if t_cw_design.fieldByName('<27><><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5>ժҪ').AsString<>'' then
begin
Explan:=getstrfromdataset(aQuery,t_cw_design.fieldByName('<27><><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5>ժҪ').AsString)
+'('+fdataset.fieldbyname('<27><><EFBFBD>ʽ').asstring+'-'+Trim(fdataset.fieldbyname('<27><><EFBFBD>غ<EFBFBD><D8BA><EFBFBD>').asstring)+')';
end;
end;
if not t_cw_design.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>ƾ֤').asboolean then
begin
if t_cw_design.fieldbyname('<27>ո<EFBFBD><D5B8><EFBFBD><EFBFBD><EFBFBD><E1B5A5>').asboolean then
dmAcc.AdotblVouItems.FieldByName('EXPLAN').AsString:=Explan
else dmAcc.AdotblVouItems.FieldByName('EXPLAN').AsString:=Explan
end
else
begin
if Trim(Explan)<>'' then
dmAcc.AdotblVouItems.FieldByName('EXPLAN').AsString:=Explan
else dmAcc.AdotblVouItems.FieldByName('EXPLAN').AsString:=MBlNo+' '+get_billStr(fDataSet.fieldByName('<27>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>').AsString);
end;
dmAcc.AdotblVouItems.FieldByName('BSNO').AsString:=fDataSet.fieldbyName('<27>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>').AsString;
dmAcc.AdotblVouItems.post;
end;
if StrToFloat(FormatFloat('0.00;-0.00;0',StlAmtDR+StlUSDAmtDR-AmtDR-USDAmtDR))<>0 then
begin
dmAcc.AdotblVouItems.Insert;
dmAcc.AdotblVouItems.FieldByName('AccID').AsString:=AccInfo.ExchangeGLID;
dmAcc.AdotblVouItems.FieldByName('FCYDR').AsFloat:=0.00;
dmAcc.AdotblVouItems.FieldByName('FCYCr').AsFloat:=0.00;
dmAcc.AdotblVouItems.FieldByName('FCYEXRATE').AsFloat:=0.00;
dmAcc.AdotblVouItems.FieldByName('AmtCr').AsFloat:=StlAmtDR+StlUSDAmtDR-AmtDR-USDAmtDR;
dmAcc.AdotblVouItems.FieldByName('AmtDR').AsFloat:=0.00;
dmAcc.AdotblVouItems.FieldByName('EXPLAN').AsString:=MBlNo+' '+get_billStr(fDataSet.fieldByName('<27>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>').AsString);
dmAcc.AdotblVouItems.FieldByName('BSNO').AsString:=fDataSet.fieldbyName('<27>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>').AsString;
dmAcc.AdotblVouItems.post;
end;
if (StlAmtCR+StlUSDAmtCR-AmtCR-USDAmtCR)<>0 then
begin
dmAcc.AdotblVouItems.Insert;
dmAcc.AdotblVouItems.FieldByName('AccID').AsString:=AccInfo.ExchangeGLID;
dmAcc.AdotblVouItems.FieldByName('FCYDR').AsFloat:=0.00;
dmAcc.AdotblVouItems.FieldByName('FCYCr').AsFloat:=0.00;
dmAcc.AdotblVouItems.FieldByName('FCYEXRATE').AsFloat:=0.00;
dmAcc.AdotblVouItems.FieldByName('AmtCr').AsFloat:=AmtCR+USDAmtCR-StlAmtCR-StlUSDAmtCR;
dmAcc.AdotblVouItems.FieldByName('AmtDR').AsFloat:=0.00;
dmAcc.AdotblVouItems.FieldByName('EXPLAN').AsString:=MBlNo+' '+get_billStr(fDataSet.fieldByName('<27>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>').AsString);
dmAcc.AdotblVouItems.FieldByName('BSNO').AsString:=fDataSet.fieldbyName('<27>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>').AsString;
dmAcc.AdotblVouItems.post;
end;
if AccInfo.ifPreTaxes and AccInfo.ifvat then
begin
amtvat:=amtvat/(1+frm_data_share.t_sys_company.fieldbyname('˰<><CBB0>').AsFloat/100)*frm_data_share.t_sys_company.fieldbyname('˰<><CBB0>').AsFloat/100;
amtvat:=StrToFloatDef(FormatFloat('0.00;-0.00;0.0',amtvat),0);
if fDataSet.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString='<27><>' then
begin
dmAcc.AdotblVouItems.Insert;
dmAcc.AdotblVouItems.FieldByName('AccID').AsString:=AccInfo.PreTaxes_Income;
dmAcc.AdotblVouItems.FieldByName('FCYDR').AsFloat:=0.00;
dmAcc.AdotblVouItems.FieldByName('FCYCr').AsFloat:=0.00;
dmAcc.AdotblVouItems.FieldByName('FCYEXRATE').AsFloat:=0;
dmAcc.AdotblVouItems.FieldByName('AmtCr').AsFloat:=0-amtvat;
dmAcc.AdotblVouItems.FieldByName('AmtDR').AsFloat:=0.00;
dmAcc.AdotblVouItems.FieldByName('EXPLAN').AsString:=MBlNo+' '+get_billStr(fDataSet.fieldByName('<27>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>').AsString);
dmAcc.AdotblVouItems.FieldByName('BSNO').AsString:=fDataSet.fieldbyName('<27>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>').AsString;
dmAcc.AdotblVouItems.post;
dmAcc.AdotblVouItems.Insert;
dmAcc.AdotblVouItems.FieldByName('AccID').AsString:=AccInfo.Taxes_Income;
dmAcc.AdotblVouItems.FieldByName('FCYDR').AsFloat:=0.00;
dmAcc.AdotblVouItems.FieldByName('FCYCr').AsFloat:=0.00;
dmAcc.AdotblVouItems.FieldByName('FCYEXRATE').AsFloat:=0;
dmAcc.AdotblVouItems.FieldByName('AmtCr').AsFloat:=amtvat;
dmAcc.AdotblVouItems.FieldByName('AmtDR').AsFloat:=0.00;
dmAcc.AdotblVouItems.FieldByName('EXPLAN').AsString:=MBlNo+' '+get_billStr(fDataSet.fieldByName('<27>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>').AsString);
dmAcc.AdotblVouItems.FieldByName('BSNO').AsString:=fDataSet.fieldbyName('<27>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>').AsString;
dmAcc.AdotblVouItems.post;
end
else
begin
dmAcc.AdotblVouItems.Insert;
dmAcc.AdotblVouItems.FieldByName('AccID').AsString:=AccInfo.PreTaxes_Cost;
dmAcc.AdotblVouItems.FieldByName('FCYDR').AsFloat:=0.00;
dmAcc.AdotblVouItems.FieldByName('FCYCr').AsFloat:=0.00;
dmAcc.AdotblVouItems.FieldByName('FCYEXRATE').AsFloat:=0;
dmAcc.AdotblVouItems.FieldByName('AmtDr').AsFloat:=0-amtvat;
dmAcc.AdotblVouItems.FieldByName('AmtCR').AsFloat:=0.00;
dmAcc.AdotblVouItems.FieldByName('EXPLAN').AsString:=MBlNo+' '+get_billStr(fDataSet.fieldByName('<27>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>').AsString);
dmAcc.AdotblVouItems.FieldByName('BSNO').AsString:=fDataSet.fieldbyName('<27>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>').AsString;
dmAcc.AdotblVouItems.post;
dmAcc.AdotblVouItems.Insert;
dmAcc.AdotblVouItems.FieldByName('AccID').AsString:=AccInfo.Taxes_Cost;
dmAcc.AdotblVouItems.FieldByName('FCYDR').AsFloat:=0.00;
dmAcc.AdotblVouItems.FieldByName('FCYCr').AsFloat:=0.00;
dmAcc.AdotblVouItems.FieldByName('FCYEXRATE').AsFloat:=0;
dmAcc.AdotblVouItems.FieldByName('AmtDr').AsFloat:=amtvat;
dmAcc.AdotblVouItems.FieldByName('AmtCR').AsFloat:=0.00;
dmAcc.AdotblVouItems.FieldByName('EXPLAN').AsString:=MBlNo+' '+get_billStr(fDataSet.fieldByName('<27>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>').AsString);
dmAcc.AdotblVouItems.FieldByName('BSNO').AsString:=fDataSet.fieldbyName('<27>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>').AsString;
dmAcc.AdotblVouItems.post;
end;
end;
dmAcc.AdotblVou.Post;
FreeAndNil(aQuery);
end;
//// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ˰
function Tfrm_cw_pingzheng_gj.NewDCVouvat(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,vat:Double;
ordno:integer;
MBlNo,wtbsnos,Explan:string;
begin
Result:=false;
aQuery:=CreateADOQuery;
aQuery2:=CreateADOQuery;
StlAmtDR:=0.00;
StlAmtCR:=0.00;
StlUSDAmtDR:=0.00;
StlUSDAmtCR:=0.00;
amtvat:=0;
dmAcc.AdotblVou.Insert;
dmAcc.AdotblVou.FieldByName('SourceType').AsInteger:=2;
dmAcc.AdotblVou.FieldByName('ATTACHS').AsInteger:=AccInfo.ATTACHS;
if Trim(t_op_balance.FieldByName('<27><><EFBFBD><EFBFBD>').AsString)='<27><>' then
begin
if Trim(t_cw_design.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD>տ<EFBFBD>ƾ֤<C6BE><D6A4>').AsString)<>'' then
begin
dmAcc.AdotblVou.FieldByName('VKNO').AsString:=Trim(t_cw_design.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD>տ<EFBFBD>ƾ֤<C6BE><D6A4>').AsString);
end
else dmAcc.AdotblVou.FieldByName('VKNO').AsString:='<27><>';
end
else
begin
if Trim(t_cw_design.FieldByName('<27><><EFBFBD>и<EFBFBD><D0B8><EFBFBD>ƾ֤<C6BE><D6A4>').AsString)<>'' then
begin
dmAcc.AdotblVou.FieldByName('VKNO').AsString:=Trim(t_cw_design.FieldByName('<27><><EFBFBD>и<EFBFBD><D0B8><EFBFBD>ƾ֤<C6BE><D6A4>').AsString);
end
else dmAcc.AdotblVou.FieldByName('VKNO').AsString:='<27><>';
end;
dmAcc.AdotblVou.FieldByName('PREPARED').AsString:=RxDBLookupCombo6.DisplayValues[0];
dmAcc.AdotblVou.Post;
dmAcc.AdotblVou.Edit;
UsdExRate:=StrToFloatDef(Edit10.Text,7.8);
with aQuery,SQL do
begin
Close;Clear;
Add('Select s.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,s.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>,s.<2E>ո<EFBFBD>,s.<2E>ұ<EFBFBD>,s.<2E><><EFBFBD><EFBFBD>,s.<2E>Ƿ<EFBFBD><C7B7>渶');
Add(',sum(S.<2E><><EFBFBD><EFBFBD>) <20><><EFBFBD><EFBFBD>,sum(S.<2E><><EFBFBD><EFBFBD>*s.<2E><><EFBFBD><EFBFBD>) <20>ϼƽ<CFBC><C6BD><EFBFBD>');
Add('from v_fee_balance_items s');
Add('where S.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>='''+fDataSet.fieldbyName('<27>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>').AsString+'''');
Add('Group By s.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,s.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>,s.<2E>ո<EFBFBD>,s.<2E>ұ<EFBFBD> ,s.<2E><><EFBFBD><EFBFBD>,s.<2E>Ƿ<EFBFBD><C7B7>渶');
Add('Order By s.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,s.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>,s.<2E>ո<EFBFBD>,s.<2E>ұ<EFBFBD> ,s.<2E><><EFBFBD><EFBFBD>,s.<2E>Ƿ<EFBFBD><C7B7>渶');
Open;
end;
aQuery.First;
while not aQuery.Eof do
begin
if aQuery.FieldByName('<27>ո<EFBFBD>').AsString='<27><>' then
begin
if aQuery.FieldByName('<27>ұ<EFBFBD>').AsString='USD' then
begin
if bsSkinCheckRadioBox7.Checked then
begin
StlUSDAmtCR:=StlUSDAmtCR+StrToFloatDef(FormatFloat('0.00;-0.00;0.0', StrToFloat(FloatToStr(aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat*aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat))), 0)
end
else
begin
StlUSDAmtCR:=StlUSDAmtCR+StrToFloatDef(FormatFloat('0.00;-0.00;0.0', StrToFloat(FloatToStr(aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat*UsdExRate))), 0);
end;
end
else
begin
StlAmtCR:=StlAmtCR+StrToFloatDef(FormatFloat('0.00;-0.00;0.0', aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat), 0);
end;
end
else
begin
if aQuery.FieldByName('<27>ұ<EFBFBD>').AsString='USD' then
begin
if bsSkinCheckRadioBox7.Checked then
StlUSDAmtDR:=StlUSDAmtDR+StrToFloatDef(FormatFloat('0.00;-0.00;0.0', StrToFloat(FloatToStr(aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat*aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat))), 0)
else
StlUSDAmtDR:=StlUSDAmtDR+StrToFloatDef(FormatFloat('0.00;-0.00;0.0', StrToFloat(FloatToStr(aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat*UsdExRate))), 0);
end
else
begin
StlAmtDR:=StlAmtDR+StrToFloatDef(FormatFloat('0.00;-0.00;0.0', aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat), 0);
end;
end;
aQuery.next;
end;
if (fDataSet.FieldByName('<27><>Ԫ<EFBFBD><D4AA><EFBFBD><EFBFBD>').Asfloat<>0) or (fDataSet.FieldByName('<27>ұ<EFBFBD>').AsString='USD') then
begin
dmAcc.AdotblVouItems.Insert;
dmAcc.AdotblVouItems.FieldByName('AccID').AsString:=GetbankAccid(fdataSet,'USD');
if fdataset.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring='<27><>' then
begin
if (StrToBool(get_parameters_value(83,'false'))) then
begin
dmAcc.AdotblVouItems.FieldByName('FCYDR').AsFloat:=StrToFloatDef(FormatFloat('0.00;-0.00;0.0',fdataset.fieldbyname('<27><>Ԫ<EFBFBD><D4AA><EFBFBD><EFBFBD>').asfloat),0);
end
else
begin
if fDataSet.FieldByName('<27>ұ<EFBFBD>').AsString='USD' then
dmAcc.AdotblVouItems.FieldByName('FCYDR').AsFloat:=StrToFloatDef(FormatFloat('0.00;-0.00;0.0',fdataset.fieldbyname('ʵ<><CAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asfloat),0)
else dmAcc.AdotblVouItems.FieldByName('FCYDR').AsFloat:=StrToFloatDef(FormatFloat('0.00;-0.00;0.0',fdataset.fieldbyname('<27><>Ԫ<EFBFBD><D4AA><EFBFBD><EFBFBD>').asfloat),0);
end;
dmAcc.AdotblVouItems.FieldByName('FCYCr').AsFloat:=0.0;
if bsSkinCheckRadioBox7.Checked then
if dmAcc.AdotblVouItems.FieldByName('FCYDR').AsFloat<>0 then
dmAcc.AdotblVouItems.FieldByName('FCYEXRATE').AsFloat:=(StlUSDAmtDR-StlUSDAmtCR)/dmAcc.AdotblVouItems.FieldByName('FCYDR').AsFloat
else dmAcc.AdotblVouItems.FieldByName('FCYEXRATE').AsFloat:=1
else
dmAcc.AdotblVouItems.FieldByName('FCYEXRATE').AsFloat:=UsdExRate;
dmAcc.AdotblVouItems.FieldByName('AmtCr').AsFloat:=0.0;
dmAcc.AdotblVouItems.FieldByName('AmtDR').AsFloat:=StlUSDAmtDR-StlUSDAmtCR;
amtvat:=amtvat+StlUSDAmtDR-StlUSDAmtCR;
end
else
begin
dmAcc.AdotblVouItems.FieldByName('FCYDR').AsFloat:=0.00;
if (StrToBool(get_parameters_value(83,'false'))) then
begin
dmAcc.AdotblVouItems.FieldByName('FCYCR').AsFloat:=StrToFloatDef(FormatFloat('0.00;-0.00;0.0',fdataset.fieldbyname('<27><>Ԫ<EFBFBD><D4AA><EFBFBD><EFBFBD>').asfloat),0);
end
else
begin
if fDataSet.FieldByName('<27>ұ<EFBFBD>').AsString='USD' then
dmAcc.AdotblVouItems.FieldByName('FCYCR').AsFloat:=StrToFloatDef(FormatFloat('0.00;-0.00;0.0',fdataset.fieldbyname('ʵ<><CAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asfloat),0)
else dmAcc.AdotblVouItems.FieldByName('FCYCR').AsFloat:=StrToFloatDef(FormatFloat('0.00;-0.00;0.0',fdataset.fieldbyname('<27><>Ԫ<EFBFBD><D4AA><EFBFBD><EFBFBD>').asfloat),0);
end;
if bsSkinCheckRadioBox7.Checked then
if dmAcc.AdotblVouItems.FieldByName('FCYCR').AsFloat<>0 then
dmAcc.AdotblVouItems.FieldByName('FCYEXRATE').AsFloat:=(StlUSDAmtCR-StlUSDAmtDR)/dmAcc.AdotblVouItems.FieldByName('FCYCR').AsFloat
else dmAcc.AdotblVouItems.FieldByName('FCYEXRATE').AsFloat:=1
else
dmAcc.AdotblVouItems.FieldByName('FCYEXRATE').AsFloat:=UsdExRate;
dmAcc.AdotblVouItems.FieldByName('AmtCr').AsFloat:=StlUSDAmtCR-StlUSDAmtDR;
dmAcc.AdotblVouItems.FieldByName('AmtDR').AsFloat:=0.00;
amtvat:=amtvat+StlUSDAmtCR-StlUSDAmtDR;
end;
dmAcc.AdotblVouItems.FieldByName('FSETTLCODE').AsString:=fdataset.fieldbyname('<27><><EFBFBD>ʽ').asstring;
if strtobool(get_parameters_value(83,'false')) then
dmAcc.AdotblVouItems.FieldByName('FSETTLENO').AsString:=Trim(fdataset.fieldbyname('<27><>Ԫ<EFBFBD><D4AA><EFBFBD>غ<EFBFBD><D8BA><EFBFBD>').asstring)
else dmAcc.AdotblVouItems.FieldByName('FSETTLENO').AsString:=Trim(fdataset.fieldbyname('<27><><EFBFBD>غ<EFBFBD><D8BA><EFBFBD>').asstring);
dmAcc.AdotblVouItems.FieldByName('CorpID').AsString:=GetCustID(aQuery.fieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString,aQuery.fieldbyname('<27>ո<EFBFBD>').AsString);
if fDataSet.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString='<27><>' then
begin
Explan:='';
if t_cw_design.fieldByName('<27><><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5>ժҪ').AsString<>'' then
begin
Explan:=getstrfromdataset(aQuery,t_cw_design.fieldByName('<27><><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5>ժҪ').AsString);
end
else Explan:=aQuery.fieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString;
end
else
begin
Explan:='';
if t_cw_design.fieldByName('<27><><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5>ժҪ').AsString<>'' then
begin
Explan:=getstrfromdataset(aQuery,t_cw_design.fieldByName('<27><><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5>ժҪ').AsString);
end
else Explan:=aQuery.fieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString;
end;
dmAcc.AdotblVouItems.FieldByName('EXPLAN').AsString:=Explan;
dmAcc.AdotblVouItems.post;
end;
if (fDataSet.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD>ҽ<EFBFBD><D2BD><EFBFBD>').Asfloat<>0) or (fDataSet.FieldByName('<27>ұ<EFBFBD>').AsString='RMB') then
begin
dmAcc.AdotblVouItems.Insert;
dmAcc.AdotblVouItems.FieldByName('AccID').AsString:=GetbankAccid(fDataSet,'RMB');
if fdataset.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring='<27><>' then
begin
dmAcc.AdotblVouItems.FieldByName('FCYDR').AsFloat:=0.0;
dmAcc.AdotblVouItems.FieldByName('FCYCr').AsFloat:=0.0;
dmAcc.AdotblVouItems.FieldByName('FCYEXRATE').AsFloat:=0.0;
dmAcc.AdotblVouItems.FieldByName('AmtCr').AsFloat:=0.0;
dmAcc.AdotblVouItems.FieldByName('AmtDR').AsFloat:=StlAmtDR-StlAmtCR;
amtvat:=amtvat+StlAmtDR-StlAmtCR;
end
else
begin
dmAcc.AdotblVouItems.FieldByName('FCYDR').AsFloat:=0.00;
dmAcc.AdotblVouItems.FieldByName('FCYCr').AsFloat:=0.00;
dmAcc.AdotblVouItems.FieldByName('FCYEXRATE').AsFloat:=0.00;
dmAcc.AdotblVouItems.FieldByName('AmtCr').AsFloat:=StlAmtCR-StlAmtDR;
dmAcc.AdotblVouItems.FieldByName('AmtDR').AsFloat:=0.00;
amtvat:=amtvat+StlAmtCR-StlAmtDR;
end;
dmAcc.AdotblVouItems.FieldByName('FSETTLCODE').AsString:=fdataset.fieldbyname('<27><><EFBFBD>ʽ').asstring;
dmAcc.AdotblVouItems.FieldByName('FSETTLENO').AsString:=Trim(fdataset.fieldbyname('<27><><EFBFBD>غ<EFBFBD><D8BA><EFBFBD>').asstring);
dmAcc.AdotblVouItems.FieldByName('CorpID').AsString:=GetCustID(aQuery.fieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString,aQuery.fieldbyname('<27>ո<EFBFBD>').AsString);
if fDataSet.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString='<27><>' then
begin
Explan:='';
if t_cw_design.fieldByName('<27><><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5>ժҪ').AsString<>'' then
begin
Explan:=getstrfromdataset(aQuery,t_cw_design.fieldByName('<27><><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5>ժҪ').AsString);
end
else
Explan:=aQuery.fieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString;
end
else
begin
Explan:='';
if t_cw_design.fieldByName('<27><><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5>ժҪ').AsString<>'' then
begin
Explan:=getstrfromdataset(aQuery,t_cw_design.fieldByName('<27><><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5>ժҪ').AsString);
end
else
Explan:=aQuery.fieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString;
end;
dmAcc.AdotblVouItems.FieldByName('EXPLAN').AsString:=Explan;
dmAcc.AdotblVouItems.FieldByName('BSNO').AsString:=fDataSet.fieldbyName('<27>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>').AsString;
dmAcc.AdotblVouItems.post;
end;
{
if StrToFloat(FormatFloat('0.00;-0.00;0',StlAmtDR+StlUSDAmtDR-AmtDR-USDAmtDR))<>0 then
begin
dmAcc.AdotblVouItems.Insert;
dmAcc.AdotblVouItems.FieldByName('AccID').AsString:=AccInfo.ExchangeGLID;
dmAcc.AdotblVouItems.FieldByName('FCYDR').AsFloat:=0.00;
dmAcc.AdotblVouItems.FieldByName('FCYCr').AsFloat:=0.00;
dmAcc.AdotblVouItems.FieldByName('FCYEXRATE').AsFloat:=0.00;
dmAcc.AdotblVouItems.FieldByName('AmtCr').AsFloat:=StlAmtDR+StlUSDAmtDR-AmtDR-USDAmtDR;
dmAcc.AdotblVouItems.FieldByName('AmtDR').AsFloat:=0.00;
dmAcc.AdotblVouItems.FieldByName('EXPLAN').AsString:=MBlNo+' '+get_billStr(fDataSet.fieldByName('<27>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>').AsString);
dmAcc.AdotblVouItems.FieldByName('BSNO').AsString:=fDataSet.fieldbyName('<27>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>').AsString;
dmAcc.AdotblVouItems.post;
end;
if (StlAmtCR+StlUSDAmtCR-AmtCR-USDAmtCR)<>0 then
begin
dmAcc.AdotblVouItems.Insert;
dmAcc.AdotblVouItems.FieldByName('AccID').AsString:=AccInfo.ExchangeGLID;
dmAcc.AdotblVouItems.FieldByName('FCYDR').AsFloat:=0.00;
dmAcc.AdotblVouItems.FieldByName('FCYCr').AsFloat:=0.00;
dmAcc.AdotblVouItems.FieldByName('FCYEXRATE').AsFloat:=0.00;
dmAcc.AdotblVouItems.FieldByName('AmtCr').AsFloat:=AmtCR+USDAmtCR-StlAmtCR-StlUSDAmtCR;
dmAcc.AdotblVouItems.FieldByName('AmtDR').AsFloat:=0.00;
dmAcc.AdotblVouItems.FieldByName('EXPLAN').AsString:=MBlNo+' '+get_billStr(fDataSet.fieldByName('<27>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>').AsString);
dmAcc.AdotblVouItems.FieldByName('BSNO').AsString:=fDataSet.fieldbyName('<27>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>').AsString;
dmAcc.AdotblVouItems.post;
end;
}
vat:=amtvat/(1+frm_data_share.t_sys_company.fieldbyname('˰<><CBB0>').AsFloat/100)*frm_data_share.t_sys_company.fieldbyname('˰<><CBB0>').AsFloat/100;
vat:=StrToFloatDef(FormatFloat('0.00;-0.00;0.0',vat),0);
if fDataSet.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString='<27><>' then
begin
dmAcc.AdotblVouItems.Insert;
dmAcc.AdotblVouItems.FieldByName('AccID').AsString:=AccInfo.DebitAccID;
dmAcc.AdotblVouItems.FieldByName('FCYDR').AsFloat:=0.00;
dmAcc.AdotblVouItems.FieldByName('FCYCr').AsFloat:=0.00;
dmAcc.AdotblVouItems.FieldByName('FCYEXRATE').AsFloat:=0;
dmAcc.AdotblVouItems.FieldByName('AmtCr').AsFloat:=amtvat-vat;
dmAcc.AdotblVouItems.FieldByName('AmtDR').AsFloat:=0.00;
dmAcc.AdotblVouItems.FieldByName('EXPLAN').AsString:='<27><><EFBFBD><EFBFBD> '+fDataSet.fieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString;
dmAcc.AdotblVouItems.FieldByName('CorpID').AsString:=GetCustID(fDataSet.fieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString,'<27><>');
dmAcc.AdotblVouItems.FieldByName('QTYSPECS').AsString:=AccInfo.CustKindName;
dmAcc.AdotblVouItems.FieldByName('BSNO').AsString:=fDataSet.fieldbyName('<27>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>').AsString;
dmAcc.AdotblVouItems.post;
dmAcc.AdotblVouItems.Insert;
dmAcc.AdotblVouItems.FieldByName('AccID').AsString:=AccInfo.Taxes_Income;
dmAcc.AdotblVouItems.FieldByName('FCYDR').AsFloat:=0.00;
dmAcc.AdotblVouItems.FieldByName('FCYCr').AsFloat:=0.00;
dmAcc.AdotblVouItems.FieldByName('FCYEXRATE').AsFloat:=0;
dmAcc.AdotblVouItems.FieldByName('AmtCr').AsFloat:=vat;
dmAcc.AdotblVouItems.FieldByName('AmtDR').AsFloat:=0.00;
dmAcc.AdotblVouItems.FieldByName('EXPLAN').AsString:='<27><><EFBFBD><EFBFBD>˰ '+fDataSet.fieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString;
dmAcc.AdotblVouItems.FieldByName('BSNO').AsString:=fDataSet.fieldbyName('<27>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>').AsString;
dmAcc.AdotblVouItems.FieldByName('CorpID').AsString:=GetCustID(fDataSet.fieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString,'<27><>');
dmAcc.AdotblVouItems.post;
end
else
begin
dmAcc.AdotblVouItems.Insert;
dmAcc.AdotblVouItems.FieldByName('AccID').AsString:=AccInfo.CreditAccID;
dmAcc.AdotblVouItems.FieldByName('FCYDR').AsFloat:=0.00;
dmAcc.AdotblVouItems.FieldByName('FCYCr').AsFloat:=0.00;
dmAcc.AdotblVouItems.FieldByName('FCYEXRATE').AsFloat:=0;
dmAcc.AdotblVouItems.FieldByName('AmtDr').AsFloat:=amtvat-vat;
dmAcc.AdotblVouItems.FieldByName('AmtCR').AsFloat:=0.00;
dmAcc.AdotblVouItems.FieldByName('EXPLAN').AsString:='<27>ɱ<EFBFBD> '+fDataSet.fieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString;
dmAcc.AdotblVouItems.FieldByName('BSNO').AsString:=fDataSet.fieldbyName('<27>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>').AsString;
dmAcc.AdotblVouItems.FieldByName('CorpID').AsString:=GetCustID(fDataSet.fieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString,'<27><>');
dmAcc.AdotblVouItems.FieldByName('QTYSPECS').AsString:=AccInfo.SuppKindName;
dmAcc.AdotblVouItems.post;
dmAcc.AdotblVouItems.Insert;
dmAcc.AdotblVouItems.FieldByName('AccID').AsString:=AccInfo.Taxes_Cost;
dmAcc.AdotblVouItems.FieldByName('FCYDR').AsFloat:=0.00;
dmAcc.AdotblVouItems.FieldByName('FCYCr').AsFloat:=0.00;
dmAcc.AdotblVouItems.FieldByName('FCYEXRATE').AsFloat:=0;
dmAcc.AdotblVouItems.FieldByName('AmtDr').AsFloat:=vat;
dmAcc.AdotblVouItems.FieldByName('AmtCR').AsFloat:=0.00;
dmAcc.AdotblVouItems.FieldByName('EXPLAN').AsString:='<27><><EFBFBD><EFBFBD>˰ '+fDataSet.fieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString;
dmAcc.AdotblVouItems.FieldByName('BSNO').AsString:=fDataSet.fieldbyName('<27>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>').AsString;
dmAcc.AdotblVouItems.FieldByName('CorpID').AsString:=GetCustID(fDataSet.fieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString,'<27><>');
dmAcc.AdotblVouItems.post;
end;
dmAcc.AdotblVou.Post;
FreeAndNil(aQuery);
end;
////
function Tfrm_cw_pingzheng_gj.InvoiceDr(fDataSet:TDataSet;ZDR:String;voudate:TDatetime):Boolean;
var
aQuery,aQuery2:TADOQuery;
mAccOK:Boolean;
aModal:TModalResult;
UsdExRate:Double;
Amt,r_Taxes_inccome:Double;
ordno:integer;
MBlNo,wtbsnos,explan:string;
begin
Result:=false;
aQuery:=CreateADOQuery;
aQuery2:=CreateADOQuery;
Amt:=0.00;
try
dmAcc.AdotblVou.Insert;
dmAcc.AdotblVou.FieldByName('SourceType').AsInteger:=1;
dmAcc.AdotblVou.FieldByName('ATTACHS').AsInteger:=AccInfo.ATTACHS;
if Trim(AccInfo.TransName)<>'' then
dmAcc.AdotblVou.FieldByName('VKNO').AsString:=AccInfo.TransName
else dmAcc.AdotblVou.FieldByName('VKNO').AsString:='<27><>';
dmAcc.AdotblVou.FieldByName('PREPARED').AsString:=RxDBLookupCombo6.DisplayValues[0];
dmAcc.AdotblVou.Post;
dmAcc.AdotblVou.Edit;
UsdExRate:=StrToFloatDef(Edit10.Text,7.8);
with aQuery,SQL do
begin
Close;Clear;
Add('Select s.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>,t_crm_client.<2E>ͻ<EFBFBD>ȫ<EFBFBD><C8AB>,s.<2E><><EFBFBD><EFBFBD> <20>ո<EFBFBD>,s.ԭʼ<D4AD>ұ<EFBFBD> <20>ұ<EFBFBD>,s.<2E><><EFBFBD><EFBFBD>');
if t_cw_design.fieldbyname('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asboolean then
Add(',s.ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
if t_cw_design.fieldbyname('ί<>б<EFBFBD><D0B1><EFBFBD>').asboolean then
Add(',s.ί<>б<EFBFBD><D0B1><EFBFBD>');
if t_cw_design.fieldbyname('<27><><EFBFBD><EFBFBD><E1B5A5>').asboolean then
Add(',s.<2E><><EFBFBD><EFBFBD><E1B5A5>');
if t_cw_design.fieldbyname('<27><><EFBFBD><EFBFBD>').asboolean then
Add(',s.<2E><><EFBFBD><EFBFBD>');
if t_cw_design.fieldbyname('<27><><EFBFBD><EFBFBD><E1B5A5>').asboolean then
Add(',s.<2E><><EFBFBD><EFBFBD>');
if t_cw_design.fieldbyname('<27><><EFBFBD>ź<EFBFBD><C5BA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asboolean then
Add(',s.<2E><><EFBFBD>۲<EFBFBD><DBB2><EFBFBD>');
if t_cw_design.fieldbyname('<27><>Ա<EFBFBD><D4B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asboolean then
Add(',s.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
if AccInfo.AccItem=1 then
Add(',f.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
Add(',sum(S.ԭʼ<D4AD><CABC><EFBFBD><EFBFBD>) <20><><EFBFBD><EFBFBD>,sum(S.ԭʼ<D4AD><CABC><EFBFBD><EFBFBD>*s.<2E><><EFBFBD><EFBFBD>) <20>ϼƽ<CFBC><C6BD><EFBFBD>');
Add('from v_fee_do_bscard s');
if AccInfo.AccItem=1 then
Add('Left Join t_Code_fee f on s.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>=f.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
Add('Left Join t_crm_client on s.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>=t_crm_client.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>');
Add('where S.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>='''+fDataSet.fieldbyName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString+'''');
Add('Group By s.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>,t_crm_client.<2E>ͻ<EFBFBD>ȫ<EFBFBD><C8AB>,s.<2E><><EFBFBD><EFBFBD>,s.ԭʼ<D4AD>ұ<EFBFBD>,s.<2E><><EFBFBD><EFBFBD>');
if t_cw_design.fieldbyname('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asboolean then
Add(',s.ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
if t_cw_design.fieldbyname('ί<>б<EFBFBD><D0B1><EFBFBD>').asboolean then
Add(',s.ί<>б<EFBFBD><D0B1><EFBFBD>');
if t_cw_design.fieldbyname('<27><><EFBFBD><EFBFBD><E1B5A5>').asboolean then
Add(',s.<2E><><EFBFBD><EFBFBD><E1B5A5>');
if t_cw_design.fieldbyname('<27><><EFBFBD><EFBFBD>').asboolean then
Add(',s.<2E><><EFBFBD><EFBFBD>');
if t_cw_design.fieldbyname('<27><><EFBFBD><EFBFBD><E1B5A5>').asboolean then
Add(',s.<2E><><EFBFBD><EFBFBD>');
if t_cw_design.fieldbyname('<27><><EFBFBD>ź<EFBFBD><C5BA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asboolean then
Add(',s.<2E><><EFBFBD>۲<EFBFBD><DBB2><EFBFBD>');
if t_cw_design.fieldbyname('<27><>Ա<EFBFBD><D4B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asboolean then
Add(',s.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
if AccInfo.AccItem=1 then
Add(',f.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
Add('Order By s.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>,s.<2E><><EFBFBD><EFBFBD>,s.ԭʼ<D4AD>ұ<EFBFBD> desc ');
Open;
end;
aQuery.First;
OrdNo:=dmAcc.AdotblVou.fieldByName('OrdNo').AsInteger;
dmAcc.AdotblVouItems.Open;
while not aQuery.Eof do
begin
dmAcc.AdotblVouItems.Insert;
dmAcc.AdotblVouItems.FieldByName('QTYSPECS').AsString:=AccInfo.CustKindName;
if aQuery.FieldByName('<27>ұ<EFBFBD>').AsString='USD' then
begin
dmAcc.AdotblVouItems.FieldByName('AccID').AsString:=AccInfo.DebitAccIDU;
if bsSkinCheckRadioBox7.Checked then
dmAcc.AdotblVouItems.FieldByName('FCYEXRATE').AsFloat:=aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat
else
dmAcc.AdotblVouItems.FieldByName('FCYEXRATE').AsFloat:=UsdExRate;
dmAcc.AdotblVouItems.FieldByName('FCYDr').AsFloat:=StrToFloatDef(FormatFloat('0.00;-0.00;0.0', aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat), 0);
dmAcc.AdotblVouItems.FieldByName('FCYCR').AsFloat:=0.00;
if bsSkinCheckRadioBox7.Checked then
dmAcc.AdotblVouItems.FieldByName('AmtDr').AsFloat:=StrToFloatDef(FormatFloat('0.00;-0.00;0.0', StrToFloat(FloatToStr(aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat*aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat))), 0)
else
dmAcc.AdotblVouItems.FieldByName('AmtDr').AsFloat:=StrToFloatDef(FormatFloat('0.00;-0.00;0.0', StrToFloat(FloatToStr(aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat*UsdExRate))), 0);
dmAcc.AdotblVouItems.FieldByName('AmtCr').AsFloat:=0.00;
if bsSkinCheckRadioBox7.Checked then
Amt:=Amt+StrToFloatDef(FormatFloat('0.00;-0.00;0.0', StrToFloat(FloatToStr(aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat*aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat))), 0)
else
Amt:=Amt+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:=AccInfo.DebitAccID;
dmAcc.AdotblVouItems.FieldByName('AmtDr').AsFloat:=StrToFloatDef(FormatFloat('0.00;-0.00;0.0',aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat),0);
dmAcc.AdotblVouItems.FieldByName('AmtCr').AsFloat:=0.00;
dmAcc.AdotblVouItems.FieldByName('FCYDR').AsFloat:=0.0;
dmAcc.AdotblVouItems.FieldByName('FCYCr').AsFloat:=0.0;
dmAcc.AdotblVouItems.FieldByName('FCYEXRATE').AsFloat:=0.0;
Amt:=Amt+StrToFloatDef(FormatFloat('0.00;-0.00;0.0', aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat), 0);
end;
explan:='';
if t_cw_design.fieldbyname('<27><><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6>ժҪ').AsString<>'' then
begin
explan:=getstrfromdataset(aQuery,t_cw_design.fieldByName('<27><><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6>ժҪ').AsString);
end
else
begin
explan:=get_strInvoice(aQuery);
end;
dmAcc.AdotblVouItems.FieldByName('EXPLAN').AsString:=explan;
dmAcc.AdotblVouItems.FieldByName('CorpID').AsString:=GetCustID(aQuery.fieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString,aQuery.fieldbyname('<27>ո<EFBFBD>').AsString);
dmAcc.AdotblVouItems.FieldByName('CorpBf').AsString:='F';
case t_cw_design.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsInteger of
0:
if t_cw_design.fieldbyname('<27><><EFBFBD><EFBFBD><E1B5A5>').asboolean then
dmAcc.AdotblVouItems.FieldByName('BSNO').AsString:=aQuery.fieldByName('<27><><EFBFBD><EFBFBD><E1B5A5>').AsString;
1:
if t_cw_design.fieldbyname('ί<>б<EFBFBD><D0B1><EFBFBD>').asboolean then
dmAcc.AdotblVouItems.FieldByName('BSNO').AsString:=aQuery.fieldByName('ί<>б<EFBFBD><D0B1><EFBFBD>').AsString;
2:
if t_cw_design.fieldbyname('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asboolean then
dmAcc.AdotblVouItems.FieldByName('BSNO').AsString:=aQuery.fieldByName('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString
end;
dmAcc.AdotblVouItems.Post;
aQuery.next;
end;
if Amt<>fDataSet.fieldbyName('<27>ϼƽ<CFBC><C6BD><EFBFBD>').AsFloat then
begin
dmAcc.AdotblVouItems.Insert;
dmAcc.AdotblVouItems.FieldByName('QTYSPECS').AsString:=AccInfo.CustKindName;
dmAcc.AdotblVouItems.FieldByName('AccID').AsString:=AccInfo.ExchangeGLID;
dmAcc.AdotblVouItems.FieldByName('AmtDr').AsFloat:=-StrToFloatDef(FormatFloat('0.00;-0.00;0.0',Amt-fDataSet.fieldbyName('<27>ϼƽ<CFBC><C6BD><EFBFBD>').AsFloat),0);
dmAcc.AdotblVouItems.FieldByName('AmtCr').AsFloat:=0.00;
dmAcc.AdotblVouItems.FieldByName('FCYDR').AsFloat:=0.0;
dmAcc.AdotblVouItems.FieldByName('FCYCr').AsFloat:=0.0;
dmAcc.AdotblVouItems.FieldByName('FCYEXRATE').AsFloat:=0.0;
Amt:=Amt+StrToFloatDef(FormatFloat('0.00;-0.00;0.0', aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat), 0);
explan:='';
if t_cw_design.fieldbyname('<27><><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6>ժҪ').AsString<>'' then
begin
explan:=getstrfromdataset(aQuery,t_cw_design.fieldByName('<27><><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6>ժҪ').AsString);
end
else
begin
explan:=get_strInvoice(aQuery);
end;
dmAcc.AdotblVouItems.FieldByName('EXPLAN').AsString:=explan;
dmAcc.AdotblVouItems.FieldByName('CorpID').AsString:=GetCustID(aQuery.fieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString,aQuery.fieldbyname('<27>ո<EFBFBD>').AsString)+'-';
dmAcc.AdotblVouItems.FieldByName('CorpBf').AsString:='F';
case t_cw_design.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsInteger of
0:
if t_cw_design.fieldbyname('<27><><EFBFBD><EFBFBD><E1B5A5>').asboolean then
dmAcc.AdotblVouItems.FieldByName('BSNO').AsString:=aQuery.fieldByName('<27><><EFBFBD><EFBFBD><E1B5A5>').AsString;
1:
if t_cw_design.fieldbyname('ί<>б<EFBFBD><D0B1><EFBFBD>').asboolean then
dmAcc.AdotblVouItems.FieldByName('BSNO').AsString:=aQuery.fieldByName('ί<>б<EFBFBD><D0B1><EFBFBD>').AsString;
2:
if t_cw_design.fieldbyname('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asboolean then
dmAcc.AdotblVouItems.FieldByName('BSNO').AsString:=aQuery.fieldByName('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString
else dmAcc.AdotblVouItems.FieldByName('BSNO').AsString:='';
end;
dmAcc.AdotblVouItems.Post;
end;
Amt:=0;
r_Taxes_inccome:=0;
dmAcc.AdotblVouItems.Insert;
dmAcc.AdotblVouItems.FieldByName('AccID').AsString:=AccInfo.ProfitAccIDU;
dmAcc.AdotblVouItems.FieldByName('FCYNO').AsString:='RMB';
Amt:=StrToFloatDef(FormatFloat('0.00;-0.00;0.0', fDataSet.fieldByName('<27>ϼƽ<CFBC><C6BD><EFBFBD>').AsFloat), 0);
r_Taxes_inccome:=StrToFloatDef(FormatFloat('0.00;-0.00;0.0', (Amt/(1+vat_value/100))*vat_value/100), 0);
explan:='';
if t_cw_design.fieldbyname('<27><>Ӫҵ<D3AA><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ժҪ').AsString<>'' then
begin
explan:=getstrfromdataset(aQuery,t_cw_design.fieldByName('<27><>Ӫҵ<D3AA><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ժҪ').AsString);
end
else
begin
explan:=get_strInvoice(aQuery);
end;
dmAcc.AdotblVouItems.FieldByName('AmtCr').AsString:=FormatFloat('0.00;-0.00;0',Amt-r_Taxes_inccome);
dmAcc.AdotblVouItems.FieldByName('AmtDr').AsFloat:=0.0;
dmAcc.AdotblVouItems.FieldByName('EXPLAN').AsString:=explan+fDataSet.fieldByName('<27><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD>').AsString;
dmAcc.AdotblVouItems.FieldByName('BSNO').AsString:='';
dmAcc.AdotblVouItems.Post;
if r_Taxes_inccome<>0 then
begin
dmAcc.AdotblVouItems.Insert;
dmAcc.AdotblVouItems.FieldByName('AccID').AsString:=AccInfo.Taxes_Income;
Amt:=StrToFloatDef(FormatFloat('0.00;-0.00;0.0', fDataSet.fieldByName('<27>ϼƽ<CFBC><C6BD><EFBFBD>').AsFloat), 0);
r_Taxes_inccome:=StrToFloatDef(FormatFloat('0.00;-0.00;0.0', (Amt/(1+vat_value/100))*vat_value/100), 0);
dmAcc.AdotblVouItems.FieldByName('AmtCr').AsFloat:=r_Taxes_inccome;
dmAcc.AdotblVouItems.FieldByName('AmtDr').AsFloat:=0.0;
dmAcc.AdotblVouItems.FieldByName('EXPLAN').AsString:='<27><><EFBFBD><EFBFBD>˰<EFBFBD><CBB0> '+fDataSet.fieldByName('<27><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD>').AsString;
dmAcc.AdotblVouItems.FieldByName('BSNO').AsString:='';
dmAcc.AdotblVouItems.Post;
end;
ordno:=dmAcc.AdotblVou.fieldbyname('ordno').asinteger;
finally
FreeAndNil(aQuery);
end;
end;
function Tfrm_cw_pingzheng_gj.InvoiceCr(fDataSet:TDataSet;ZDR:String;voudate:TDatetime):Boolean;
var
aQuery,aQuery2:TADOQuery;
mAccOK:Boolean;
aModal:TModalResult;
UsdExRate:Double;
Amt,ttlamt,r_Taxes_inccome,priceAmt,Amt1,Amt2:Double;
ordno:integer;
MBlNo,wtbsnos,explan:string;
begin
Result:=false;
aQuery:=CreateADOQuery;
aQuery2:=CreateADOQuery;
UsdExRate:=StrToFloatDef(Edit10.Text,7.8);
Amt:=0.00;
Amt1:=0.00;
Amt2:=0.00;
try
with aQuery,SQL do
begin
Close;Clear;
Add('Select s.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>,t_crm_client.<2E>ͻ<EFBFBD>ȫ<EFBFBD><C8AB>,s.<2E><><EFBFBD><EFBFBD> <20>ո<EFBFBD>,s.ԭʼ<D4AD>ұ<EFBFBD> <20>ұ<EFBFBD>,s.<2E><><EFBFBD><EFBFBD>');
Add(',s.ί<>б<EFBFBD><D0B1><EFBFBD>');
Add(',sum(S.ԭʼ<D4AD><CABC><EFBFBD><EFBFBD>) <20><><EFBFBD><EFBFBD>,sum(S.ԭʼ<D4AD><CABC><EFBFBD><EFBFBD>*s.<2E><><EFBFBD><EFBFBD>) <20>ϼƽ<CFBC><C6BD><EFBFBD>');
Add('from v_fee_do_bscard s');
Add('Left Join t_crm_client on s.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>=t_crm_client.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>');
Add('where isnull(s.Ԥ<><D4A4><EFBFBD>ɱ<EFBFBD>,0)=0 and S.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>='''+fDataSet.fieldbyName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString+'''');
Add('Group By s.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>,t_crm_client.<2E>ͻ<EFBFBD>ȫ<EFBFBD><C8AB>,s.<2E><><EFBFBD><EFBFBD>,s.ԭʼ<D4AD>ұ<EFBFBD>,s.<2E><><EFBFBD><EFBFBD>');
Add(',s.ί<>б<EFBFBD><D0B1><EFBFBD>');
Add('Order By s.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>,s.<2E><><EFBFBD><EFBFBD>,s.ԭʼ<D4AD>ұ<EFBFBD> desc ');
Open;
end;
aQuery.First;
while not aQuery.Eof do
begin
if aQuery.FieldByName('<27>ұ<EFBFBD>').AsString='USD' then
begin
if bsSkinCheckRadioBox7.Checked then
Amt:=s_w(2,Amt)+s_w(2,aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat*aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat)
else
Amt:=s_w(2,Amt)+s_w(2,aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat*UsdExRate);
end
else
begin
Amt:=s_w(2,Amt)+s_w(2,aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat);
end;
aQuery.Next;
end;
dmAcc.AdotblVouItems.Open;
if Amt<>0 then
begin
Amt:=s_w(2,Amt);
r_Taxes_inccome:=s_w(2,Amt/(1+fDataSet.fieldbyname('˰<><CBB0>').AsFloat/100)*fDataSet.fieldbyname('˰<><CBB0>').AsFloat/100);
explan:='';
if t_cw_design.fieldbyname('<27><>Ӫҵ<D3AA><D2B5><EFBFBD>ɱ<EFBFBD>ժҪ').AsString<>'' then
begin
explan:=getstrfromdataset(aQuery,t_cw_design.fieldByName('<27><>Ӫҵ<D3AA><D2B5><EFBFBD>ɱ<EFBFBD>ժҪ').AsString);
end
else
begin
explan:=get_strInvoice(aQuery);
end;
dmAcc.AdotblVouItems.Insert;
dmAcc.AdotblVouItems.FieldByName('AccID').AsString:=AccInfo.ImpProfitAccID;
dmAcc.AdotblVouItems.FieldByName('FCYEXRATE').AsFloat:=1;
dmAcc.AdotblVouItems.FieldByName('FCYNO').AsString:='RMB';
dmAcc.AdotblVouItems.FieldByName('AmtDr').AsFloat:=s_w(2,Amt-r_Taxes_inccome);
dmAcc.AdotblVouItems.FieldByName('AmtCr').AsFloat:=0.0;
dmAcc.AdotblVouItems.FieldByName('EXPLAN').AsString:=explan+fDataSet.fieldByName('<27><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD>').AsString;
dmAcc.AdotblVouItems.FieldByName('BSNO').AsString:='';
dmAcc.AdotblVouItems.Post;
dmAcc.AdotblVouItems.Insert;
dmAcc.AdotblVouItems.FieldByName('AccID').AsString:=AccInfo.Taxes_Cost;
dmAcc.AdotblVouItems.FieldByName('FCYEXRATE').AsFloat:=1;
dmAcc.AdotblVouItems.FieldByName('FCYNO').AsString:='RMB';
dmAcc.AdotblVouItems.FieldByName('AmtDr').AsFloat:=r_Taxes_inccome;
dmAcc.AdotblVouItems.FieldByName('AmtCr').AsFloat:=0.0;
dmAcc.AdotblVouItems.FieldByName('EXPLAN').AsString:='˰<><CBB0> '+fDataSet.fieldByName('<27><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD>').AsString;
dmAcc.AdotblVouItems.FieldByName('BSNO').AsString:='';
dmAcc.AdotblVouItems.Post;
Amt1:=Amt;
Amt:=0.00;
OrdNo:=dmAcc.AdotblVou.fieldByName('OrdNo').AsInteger;
aQuery.First;
while not aQuery.Eof do
begin
dmAcc.AdotblVouItems.Insert;
dmAcc.AdotblVouItems.FieldByName('QTYSPECS').AsString:=AccInfo.SuppKindName;
if aQuery.FieldByName('<27>ұ<EFBFBD>').AsString='USD' then
begin
dmAcc.AdotblVouItems.FieldByName('AccID').AsString:=AccInfo.CreditAccIDU;
if bsSkinCheckRadioBox7.Checked then
dmAcc.AdotblVouItems.FieldByName('FCYEXRATE').AsFloat:=aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat
else
dmAcc.AdotblVouItems.FieldByName('FCYEXRATE').AsFloat:=UsdExRate;
dmAcc.AdotblVouItems.FieldByName('FCYDR').AsFloat:=0.00;
dmAcc.AdotblVouItems.FieldByName('FCYCr').AsFloat:=s_w(2,aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat);
if bsSkinCheckRadioBox7.Checked then
begin
dmAcc.AdotblVouItems.FieldByName('AmtCr').AsFloat:=s_w(2,aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat*aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat);
Amt:=Amt+s_w(2,dmAcc.AdotblVouItems.FieldByName('AmtCr').AsFloat);
end
else
begin
dmAcc.AdotblVouItems.FieldByName('AmtCr').AsFloat:=s_w(2,aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat*UsdExRate);
Amt:=Amt+s_w(2,dmAcc.AdotblVouItems.FieldByName('AmtCr').AsFloat);
end;
dmAcc.AdotblVouItems.FieldByName('AmtDr').AsFloat:=0.00;
end
else
begin
dmAcc.AdotblVouItems.FieldByName('AccID').AsString:=AccInfo.CreditAccID;
dmAcc.AdotblVouItems.FieldByName('AmtCr').AsFloat:=s_w(2,aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat);
dmAcc.AdotblVouItems.FieldByName('AmtDr').AsFloat:=0.00;
dmAcc.AdotblVouItems.FieldByName('FCYCR').AsFloat:=0.0;
dmAcc.AdotblVouItems.FieldByName('FCYDr').AsFloat:=0.0;
dmAcc.AdotblVouItems.FieldByName('FCYEXRATE').AsFloat:=0.0;
Amt:=Amt+s_w(2,dmAcc.AdotblVouItems.FieldByName('AmtCr').AsFloat);
end;
explan:='';
if t_cw_design.fieldbyname('<27><><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6>ժҪ').AsString<>'' then
begin
explan:=getstrfromdataset(aQuery,t_cw_design.fieldByName('<27><><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6>ժҪ').AsString);
end
else
begin
explan:=get_strInvoice(aQuery);
end;
dmAcc.AdotblVouItems.FieldByName('EXPLAN').AsString:=explan;
dmAcc.AdotblVouItems.FieldByName('CorpID').AsString:=GetCustID(aQuery.fieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString,aQuery.fieldbyname('<27>ո<EFBFBD>').AsString);
dmAcc.AdotblVouItems.FieldByName('CorpBf').AsString:='F';
dmAcc.AdotblVouItems.FieldByName('BSNO').AsString:=aQuery.fieldByName('ί<>б<EFBFBD><D0B1><EFBFBD>').AsString;
dmAcc.AdotblVouItems.Post;
aQuery.next;
end;
end;
Amt2:=Amt;
if FormatFloat('0.00;-0.00;0',Amt2-Amt1)<>'0' then
begin
dmAcc.AdotblVouItems.Insert;
dmAcc.AdotblVouItems.FieldByName('AccID').AsString:=AccInfo.ExchangeGLID;
dmAcc.AdotblVouItems.FieldByName('FCYCR').AsFloat:=0.0;
dmAcc.AdotblVouItems.FieldByName('FCYDr').AsFloat:=0.0;
dmAcc.AdotblVouItems.FieldByName('FCYNO').AsString:='RMB';
dmAcc.AdotblVouItems.FieldByName('FCYEXRATE').AsFloat:=1;
dmAcc.AdotblVouItems.FieldByName('Amtdr').AsString:=FormatFloat('0.00;-0.00;0',Amt2-Amt1);
dmAcc.AdotblVouItems.FieldByName('Amtcr').AsFloat:=0.00;
dmAcc.AdotblVouItems.FieldByName('EXPLAN').AsString:=explan;
dmAcc.AdotblVouItems.FieldByName('CorpID').AsString:=GetCustID(aQuery.fieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString,aQuery.fieldbyname('<27>ո<EFBFBD>').AsString);
dmAcc.AdotblVouItems.FieldByName('CorpBf').AsString:='F';
dmAcc.AdotblVouItems.FieldByName('BSNO').AsString:=aQuery.fieldByName('ί<>б<EFBFBD><D0B1><EFBFBD>').AsString;
dmAcc.AdotblVouItems.Post;
end;
/// Ԥ<><D4A4>
Amt:=0.00;
priceAmt:=0.00;
with aQuery,SQL do
begin
Close;Clear;
Add('Select s.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>,t_crm_client.<2E>ͻ<EFBFBD>ȫ<EFBFBD><C8AB>,s.<2E><><EFBFBD><EFBFBD> <20>ո<EFBFBD>,s.ԭʼ<D4AD>ұ<EFBFBD> <20>ұ<EFBFBD>,s.<2E><><EFBFBD><EFBFBD>');
Add(',s.ί<>б<EFBFBD><D0B1><EFBFBD>');
Add(',sum(S.ԭʼ<D4AD><CABC><EFBFBD><EFBFBD>) <20><><EFBFBD><EFBFBD>,sum(S.ԭʼ<D4AD><CABC><EFBFBD><EFBFBD>*s.<2E><><EFBFBD><EFBFBD>) <20>ϼƽ<CFBC><C6BD><EFBFBD>');
Add('from v_fee_do_bscard s');
Add('Left Join t_crm_client on s.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>=t_crm_client.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>');
Add('where isnull(s.Ԥ<><D4A4><EFBFBD>ɱ<EFBFBD>,0)<>0 and S.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>='''+fDataSet.fieldbyName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString+'''');
Add('Group By s.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>,t_crm_client.<2E>ͻ<EFBFBD>ȫ<EFBFBD><C8AB>,s.<2E><><EFBFBD><EFBFBD>,s.ԭʼ<D4AD>ұ<EFBFBD>,s.<2E><><EFBFBD><EFBFBD>');
Add(',s.ί<>б<EFBFBD><D0B1><EFBFBD>');
Add('Order By s.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>,s.<2E><><EFBFBD><EFBFBD>,s.ԭʼ<D4AD>ұ<EFBFBD> desc ');
Open;
end;
aQuery.First;
while not aQuery.Eof do
begin
if aQuery.FieldByName('<27>ұ<EFBFBD>').AsString='USD' then
begin
if bsSkinCheckRadioBox7.Checked then
begin
Amt:=s_w(2,Amt)+s_w(2,aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat*aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat);
priceAmt:=s_w(2,priceAmt)+s_w(2,aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat*aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat/(1+fDataSet.fieldbyname('˰<><CBB0>').AsFloat/100));
end
else
begin
Amt:=s_w(2,Amt)+s_w(2,aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat*UsdExRate);
priceAmt:=s_w(2,priceAmt)+s_w(2,aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat*UsdExRate/(1+fDataSet.fieldbyname('˰<><CBB0>').AsFloat/100));
end;
end
else
begin
Amt:=s_w(2,Amt)+s_w(2,aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat);
priceAmt:=s_w(2,priceAmt)+s_w(2,aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat/(1+fDataSet.fieldbyname('˰<><CBB0>').AsFloat/100));
end;
aQuery.Next;
end;
// Amt:=0;
if Amt<>0 then
begin
UsdExRate:=StrToFloatDef(Edit10.Text,7.8);
r_Taxes_inccome:=s_w(2,Amt-priceAmt);
explan:='';
if t_cw_design.fieldbyname('<27><>Ӫҵ<D3AA><D2B5><EFBFBD>ɱ<EFBFBD>ժҪ').AsString<>'' then
begin
explan:=getstrfromdataset(aQuery,t_cw_design.fieldByName('<27><>Ӫҵ<D3AA><D2B5><EFBFBD>ɱ<EFBFBD>ժҪ').AsString);
end
else
begin
explan:=get_strInvoice(aQuery);
end;
dmAcc.AdotblVouItems.Insert;
dmAcc.AdotblVouItems.FieldByName('AccID').AsString:=AccInfo.ImpProfitAccID;
dmAcc.AdotblVouItems.FieldByName('FCYEXRATE').AsFloat:=1;
dmAcc.AdotblVouItems.FieldByName('FCYNO').AsString:='RMB';
dmAcc.AdotblVouItems.FieldByName('AmtDr').AsFloat:=priceAmt;
dmAcc.AdotblVouItems.FieldByName('AmtCr').AsFloat:=0.0;
dmAcc.AdotblVouItems.FieldByName('EXPLAN').AsString:=explan+fDataSet.fieldByName('<27><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD>').AsString;
dmAcc.AdotblVouItems.FieldByName('BSNO').AsString:='';
dmAcc.AdotblVouItems.Post;
dmAcc.AdotblVouItems.Insert;
dmAcc.AdotblVouItems.FieldByName('AccID').AsString:=AccInfo.Taxes_Cost;
dmAcc.AdotblVouItems.FieldByName('FCYEXRATE').AsFloat:=1;
dmAcc.AdotblVouItems.FieldByName('FCYNO').AsString:='RMB';
dmAcc.AdotblVouItems.FieldByName('AmtDr').AsFloat:=r_Taxes_inccome;
dmAcc.AdotblVouItems.FieldByName('AmtCr').AsFloat:=0.0;
dmAcc.AdotblVouItems.FieldByName('EXPLAN').AsString:='˰<><CBB0> '+fDataSet.fieldByName('<27><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD>').AsString;
dmAcc.AdotblVouItems.FieldByName('BSNO').AsString:='';
dmAcc.AdotblVouItems.Post;
// OrdNo:=dmAcc.AdotblVou.fieldByName('OrdNo').AsInteger;
//Ӧ<><D3A6><EFBFBD>˿<EFBFBD>
Amt1:=Amt;
Amt:=0;
aQuery.First;
while not aQuery.Eof do
begin
dmAcc.AdotblVouItems.Insert;
dmAcc.AdotblVouItems.FieldByName('QTYSPECS').AsString:=AccInfo.SuppKindName;
if aQuery.FieldByName('<27>ұ<EFBFBD>').AsString='USD' then
begin
dmAcc.AdotblVouItems.FieldByName('AccID').AsString:=AccInfo.CreditAccIDU;
if bsSkinCheckRadioBox7.Checked then
dmAcc.AdotblVouItems.FieldByName('FCYEXRATE').AsFloat:=aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat
else
dmAcc.AdotblVouItems.FieldByName('FCYEXRATE').AsFloat:=UsdExRate;
dmAcc.AdotblVouItems.FieldByName('FCYDR').AsFloat:=0.00;
dmAcc.AdotblVouItems.FieldByName('FCYCr').AsFloat
:=s_w(2,aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat/(1+fDataSet.fieldbyname('˰<><CBB0>').AsFloat/100)*fDataSet.fieldbyname('˰<><CBB0>').AsFloat/100);
if bsSkinCheckRadioBox7.Checked then
begin
dmAcc.AdotblVouItems.FieldByName('AmtCr').AsFloat
:=s_w(2,aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat*aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat/(1+fDataSet.fieldbyname('˰<><CBB0>').AsFloat/100)*fDataSet.fieldbyname('˰<><CBB0>').AsFloat/100);
Amt:=Amt+s_w(2,dmAcc.AdotblVouItems.FieldByName('AmtCr').AsFloat);
end
else
begin
dmAcc.AdotblVouItems.FieldByName('AmtCr').AsFloat
:=s_w(2,aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat*UsdExRate/(1+fDataSet.fieldbyname('˰<><CBB0>').AsFloat/100)*fDataSet.fieldbyname('˰<><CBB0>').AsFloat/100);
Amt:=s_w(2,Amt)+s_w(2,dmAcc.AdotblVouItems.FieldByName('AmtCr').AsFloat);
end;
dmAcc.AdotblVouItems.FieldByName('AmtDr').AsFloat:=0.00;
end
else
begin
dmAcc.AdotblVouItems.FieldByName('AccID').AsString:=AccInfo.CreditAccID;
dmAcc.AdotblVouItems.FieldByName('AmtCr').AsFloat
:=s_w(2,aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat/(1+fDataSet.fieldbyname('˰<><CBB0>').AsFloat/100)*fDataSet.fieldbyname('˰<><CBB0>').AsFloat/100);
Amt:=s_w(2,Amt)+s_w(2,dmAcc.AdotblVouItems.FieldByName('AmtCr').AsFloat);
dmAcc.AdotblVouItems.FieldByName('AmtDr').AsFloat:=0.00;
dmAcc.AdotblVouItems.FieldByName('FCYCR').AsFloat:=0.0;
dmAcc.AdotblVouItems.FieldByName('FCYDr').AsFloat:=0.0;
dmAcc.AdotblVouItems.FieldByName('FCYEXRATE').AsFloat:=0.0;
end;
explan:='';
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,aQuery.fieldbyname('<27>ո<EFBFBD>').AsString);
dmAcc.AdotblVouItems.FieldByName('CorpBf').AsString:='F';
dmAcc.AdotblVouItems.FieldByName('BSNO').AsString:=aQuery.fieldByName('ί<>б<EFBFBD><D0B1><EFBFBD>').AsString;
dmAcc.AdotblVouItems.Post;
aQuery.next;
ordno:=dmAcc.AdotblVou.fieldbyname('ordno').asinteger;
end;
//<2F><><EFBFBD><EFBFBD>Ԥ<EFBFBD><D4A4><EFBFBD>ɱ<EFBFBD>
aQuery.First;
while not aQuery.Eof do
begin
dmAcc.AdotblVouItems.Insert;
dmAcc.AdotblVouItems.FieldByName('QTYSPECS').AsString:=AccInfo.SuppKindName;
if aQuery.FieldByName('<27>ұ<EFBFBD>').AsString='USD' then
begin
dmAcc.AdotblVouItems.FieldByName('AccID').AsString:='5121.021';
if bsSkinCheckRadioBox7.Checked then
dmAcc.AdotblVouItems.FieldByName('FCYEXRATE').AsFloat:=aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat
else
dmAcc.AdotblVouItems.FieldByName('FCYEXRATE').AsFloat:=UsdExRate;
dmAcc.AdotblVouItems.FieldByName('FCYDR').AsFloat:=0.00;
dmAcc.AdotblVouItems.FieldByName('FCYCr').AsFloat
:=s_w(2,aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat/(1+fDataSet.fieldbyname('˰<><CBB0>').AsFloat/100));
if bsSkinCheckRadioBox7.Checked then
begin
dmAcc.AdotblVouItems.FieldByName('AmtCr').AsFloat
:=s_w(2,aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat*aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat/(1+fDataSet.fieldbyname('˰<><CBB0>').AsFloat/100));
Amt:=Amt+s_w(2,dmAcc.AdotblVouItems.FieldByName('AmtCr').AsFloat);
end
else
begin
dmAcc.AdotblVouItems.FieldByName('AmtCr').AsFloat
:=s_w(2,aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat*UsdExRate/(1+fDataSet.fieldbyname('˰<><CBB0>').AsFloat/100));
Amt:=Amt+s_w(2,dmAcc.AdotblVouItems.FieldByName('AmtCr').AsFloat);
end;
dmAcc.AdotblVouItems.FieldByName('AmtDr').AsFloat:=0.00;
end
else
begin
dmAcc.AdotblVouItems.FieldByName('AccID').AsString:='5121.021';
dmAcc.AdotblVouItems.FieldByName('AmtCr').AsFloat
:=s_w(2,aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat/(1+fDataSet.fieldbyname('˰<><CBB0>').AsFloat/100));
Amt:=Amt+s_w(2,dmAcc.AdotblVouItems.FieldByName('AmtCr').AsFloat);
dmAcc.AdotblVouItems.FieldByName('AmtDr').AsFloat:=0.00;
dmAcc.AdotblVouItems.FieldByName('FCYDR').AsFloat:=0.0;
dmAcc.AdotblVouItems.FieldByName('FCYCr').AsFloat:=0.0;
dmAcc.AdotblVouItems.FieldByName('FCYEXRATE').AsFloat:=0.0;
end;
explan:='';
if t_cw_design.fieldbyname('<27><><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6>ժҪ').AsString<>'' then
begin
explan:=getstrfromdataset(aQuery,t_cw_design.fieldByName('<27><><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6>ժҪ').AsString);
end
else
begin
explan:=get_strInvoice(aQuery);
end;
dmAcc.AdotblVouItems.FieldByName('EXPLAN').AsString:='Ԥ<><D4A4>'+explan;
dmAcc.AdotblVouItems.FieldByName('CorpID').AsString:=GetCustID(aQuery.fieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString,aQuery.fieldbyname('<27>ո<EFBFBD>').AsString);
dmAcc.AdotblVouItems.FieldByName('CorpBf').AsString:='F';
dmAcc.AdotblVouItems.FieldByName('BSNO').AsString:=aQuery.fieldByName('ί<>б<EFBFBD><D0B1><EFBFBD>').AsString;
dmAcc.AdotblVouItems.Post;
aQuery.next;
ordno:=dmAcc.AdotblVou.fieldbyname('ordno').asinteger;
end;
Amt2:=Amt;
// ShowMessage(FloatToStr(Amt1)+' '+FloatToStr(Amt2));
//ShowMessage('1-2:'+FormatFloat('0.00;-0.00;0',Amt1-Amt2));
// ShowMessage('2-1:'+FormatFloat('0.00;-0.00;0',Amt2-Amt1));
if FormatFloat('0.00;-0.00;0',Amt2-Amt1)<>'0' then
begin
dmAcc.AdotblVouItems.Insert;
dmAcc.AdotblVouItems.FieldByName('AccID').AsString:=AccInfo.ExchangeGLID;
dmAcc.AdotblVouItems.FieldByName('FCYCR').AsFloat:=0.0;
dmAcc.AdotblVouItems.FieldByName('FCYDr').AsFloat:=0.0;
dmAcc.AdotblVouItems.FieldByName('FCYNO').AsString:='RMB';
dmAcc.AdotblVouItems.FieldByName('FCYEXRATE').AsFloat:=1;
dmAcc.AdotblVouItems.FieldByName('Amtdr').AsString:=FormatFloat('0.00;-0.00;0',Amt2-Amt1);
// ShowMessage(FloatToStr(dmAcc.AdotblVouItems.FieldByName('Amtdr').AsFloat));
dmAcc.AdotblVouItems.FieldByName('Amtcr').AsFloat:=0.00;
dmAcc.AdotblVouItems.FieldByName('EXPLAN').AsString:=explan;
dmAcc.AdotblVouItems.FieldByName('CorpID').AsString:=GetCustID(aQuery.fieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString,aQuery.fieldbyname('<27>ո<EFBFBD>').AsString);
dmAcc.AdotblVouItems.FieldByName('CorpBf').AsString:='F';
dmAcc.AdotblVouItems.FieldByName('BSNO').AsString:=aQuery.fieldByName('ί<>б<EFBFBD><D0B1><EFBFBD>').AsString;
dmAcc.AdotblVouItems.Post;
// ShowMessage(FloatToStr(dmAcc.AdotblVouItems.FieldByName('Amtdr').AsFloat));
end;
end;
finally
FreeAndNil(aQuery);
end;
end;
{function Tfrm_cw_pingzheng_gj.InvoiceCr(fDataSet:TDataSet;ZDR:String;voudate:TDatetime):Boolean;
var
aQuery,aQuery2:TADOQuery;
mAccOK:Boolean;
aModal:TModalResult;
UsdExRate:Double;
Amt,r_Taxes_inccome:Double;
ordno:integer;
MBlNo,wtbsnos,explan:string;
begin
Result:=false;
aQuery:=CreateADOQuery;
aQuery2:=CreateADOQuery;
Amt:=0.00;
try
with aQuery,SQL do
begin
Close;Clear;
Add('Select s.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>,t_crm_client.<2E>ͻ<EFBFBD>ȫ<EFBFBD><C8AB>,s.<2E><><EFBFBD><EFBFBD> <20>ո<EFBFBD>,s.ԭʼ<D4AD>ұ<EFBFBD> <20>ұ<EFBFBD>,s.<2E><><EFBFBD><EFBFBD>');
if t_cw_design.fieldbyname('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asboolean then
Add(',s.ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
if t_cw_design.fieldbyname('ί<>б<EFBFBD><D0B1><EFBFBD>').asboolean then
Add(',s.ί<>б<EFBFBD><D0B1><EFBFBD>');
if t_cw_design.fieldbyname('<27><><EFBFBD><EFBFBD><E1B5A5>').asboolean then
Add(',s.<2E><><EFBFBD><EFBFBD><E1B5A5>');
if t_cw_design.fieldbyname('<27><><EFBFBD><EFBFBD>').asboolean then
Add(',s.<2E><><EFBFBD><EFBFBD>');
if t_cw_design.fieldbyname('<27><><EFBFBD><EFBFBD><E1B5A5>').asboolean then
Add(',s.<2E><><EFBFBD><EFBFBD>');
if t_cw_design.fieldbyname('<27><><EFBFBD>ź<EFBFBD><C5BA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asboolean then
Add(',s.<2E><><EFBFBD>۲<EFBFBD><DBB2><EFBFBD>');
if t_cw_design.fieldbyname('<27><>Ա<EFBFBD><D4B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asboolean then
Add(',s.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
if AccInfo.AccItem=1 then
Add(',f.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
Add(',sum(S.ԭʼ<D4AD><CABC><EFBFBD><EFBFBD>) <20><><EFBFBD><EFBFBD>,sum(S.ԭʼ<D4AD><CABC><EFBFBD><EFBFBD>*s.<2E><><EFBFBD><EFBFBD>) <20>ϼƽ<CFBC><C6BD><EFBFBD>');
Add('from v_fee_do_bscard s');
if AccInfo.AccItem=1 then
Add('Left Join t_Code_fee f on s.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>=f.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
Add('Left Join t_crm_client on s.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>=t_crm_client.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>');
Add('where S.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>='''+fDataSet.fieldbyName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString+'''');
Add('Group By s.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>,t_crm_client.<2E>ͻ<EFBFBD>ȫ<EFBFBD><C8AB>,s.<2E><><EFBFBD><EFBFBD>,s.ԭʼ<D4AD>ұ<EFBFBD>,s.<2E><><EFBFBD><EFBFBD>');
if t_cw_design.fieldbyname('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asboolean then
Add(',s.ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
if t_cw_design.fieldbyname('ί<>б<EFBFBD><D0B1><EFBFBD>').asboolean then
Add(',s.ί<>б<EFBFBD><D0B1><EFBFBD>');
if t_cw_design.fieldbyname('<27><><EFBFBD><EFBFBD><E1B5A5>').asboolean then
Add(',s.<2E><><EFBFBD><EFBFBD><E1B5A5>');
if t_cw_design.fieldbyname('<27><><EFBFBD><EFBFBD>').asboolean then
Add(',s.<2E><><EFBFBD><EFBFBD>');
if t_cw_design.fieldbyname('<27><><EFBFBD><EFBFBD><E1B5A5>').asboolean then
Add(',s.<2E><><EFBFBD><EFBFBD>');
if t_cw_design.fieldbyname('<27><><EFBFBD>ź<EFBFBD><C5BA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asboolean then
Add(',s.<2E><><EFBFBD>۲<EFBFBD><DBB2><EFBFBD>');
if t_cw_design.fieldbyname('<27><>Ա<EFBFBD><D4B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asboolean then
Add(',s.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
if AccInfo.AccItem=1 then
Add(',f.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
Add('Order By s.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>,s.<2E><><EFBFBD><EFBFBD>,s.ԭʼ<D4AD>ұ<EFBFBD> desc ');
Open;
end;
aQuery.First;
dmAcc.AdotblVou.Insert;
dmAcc.AdotblVou.FieldByName('SourceType').AsInteger:=1;
dmAcc.AdotblVou.FieldByName('ATTACHS').AsInteger:=AccInfo.ATTACHS;
if Trim(AccInfo.TransName)<>'' then
dmAcc.AdotblVou.FieldByName('VKNO').AsString:=AccInfo.TransName
else dmAcc.AdotblVou.FieldByName('VKNO').AsString:='<27><>';
dmAcc.AdotblVou.FieldByName('PREPARED').AsString:=RxDBLookupCombo6.DisplayValues[0];
dmAcc.AdotblVou.Post;
dmAcc.AdotblVou.Edit;
UsdExRate:=StrToFloatDef(Edit10.Text,7.8);
Amt:=StrToFloatDef(FormatFloat('0.00;-0.00;0.0', fDataSet.fieldByName('ʵ<>ʽ<EFBFBD><CABD><EFBFBD>').AsFloat+fDataSet.fieldbyName('<27><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD>').AsFloat), 0);
r_Taxes_inccome:=StrToFloatDef(FormatFloat('0.00;-0.00;0.0', (Amt/(1+fDataSet.fieldbyname('˰<><CBB0>').AsFloat/100))*fDataSet.fieldbyname('˰<><CBB0>').AsFloat/100), 0);
explan:='';
if t_cw_design.fieldbyname('<27><>Ӫҵ<D3AA><D2B5><EFBFBD>ɱ<EFBFBD>ժҪ').AsString<>'' then
begin
explan:=getstrfromdataset(aQuery,t_cw_design.fieldByName('<27><>Ӫҵ<D3AA><D2B5><EFBFBD>ɱ<EFBFBD>ժҪ').AsString);
end
else
begin
explan:=get_strInvoice(aQuery);
end;
dmAcc.AdotblVouItems.Insert;
dmAcc.AdotblVouItems.FieldByName('AccID').AsString:=AccInfo.ImpProfitAccID;
dmAcc.AdotblVouItems.FieldByName('FCYEXRATE').AsFloat:=1;
dmAcc.AdotblVouItems.FieldByName('FCYNO').AsString:='RMB';
dmAcc.AdotblVouItems.FieldByName('AmtDr').AsFloat:=Amt-r_Taxes_inccome;
dmAcc.AdotblVouItems.FieldByName('AmtCr').AsFloat:=0.0;
dmAcc.AdotblVouItems.FieldByName('EXPLAN').AsString:=explan;
dmAcc.AdotblVouItems.FieldByName('BSNO').AsString:='';
dmAcc.AdotblVouItems.Post;
dmAcc.AdotblVouItems.Insert;
dmAcc.AdotblVouItems.FieldByName('AccID').AsString:=AccInfo.Taxes_Cost;
dmAcc.AdotblVouItems.FieldByName('FCYEXRATE').AsFloat:=1;
dmAcc.AdotblVouItems.FieldByName('FCYNO').AsString:='RMB';
dmAcc.AdotblVouItems.FieldByName('AmtDr').AsFloat:=r_Taxes_inccome;
dmAcc.AdotblVouItems.FieldByName('AmtCr').AsFloat:=0.0;
dmAcc.AdotblVouItems.FieldByName('EXPLAN').AsString:='˰<><CBB0> '+fDataSet.fieldByName('<27><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD>').AsString;
dmAcc.AdotblVouItems.FieldByName('BSNO').AsString:='';
dmAcc.AdotblVouItems.Post;
Amt:=0.00;
OrdNo:=dmAcc.AdotblVou.fieldByName('OrdNo').AsInteger;
dmAcc.AdotblVouItems.Open;
while not aQuery.Eof do
begin
dmAcc.AdotblVouItems.Insert;
dmAcc.AdotblVouItems.FieldByName('QTYSPECS').AsString:=AccInfo.SuppKindName;
if aQuery.FieldByName('<27>ұ<EFBFBD>').AsString='USD' then
begin
dmAcc.AdotblVouItems.FieldByName('AccID').AsString:=AccInfo.CreditAccIDU;
if bsSkinCheckRadioBox7.Checked then
dmAcc.AdotblVouItems.FieldByName('FCYEXRATE').AsFloat:=aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat
else
dmAcc.AdotblVouItems.FieldByName('FCYEXRATE').AsFloat:=UsdExRate;
dmAcc.AdotblVouItems.FieldByName('FCYDR').AsFloat:=0.00;
dmAcc.AdotblVouItems.FieldByName('FCYCr').AsFloat:=StrToFloatDef(FormatFloat('0.00;-0.00;0.0', aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat), 0);
if bsSkinCheckRadioBox7.Checked then
dmAcc.AdotblVouItems.FieldByName('AmtCr').AsFloat:=StrToFloatDef(FormatFloat('0.00;-0.00;0.0', StrToFloat(FloatToStr(aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat*aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat))), 0)
else
dmAcc.AdotblVouItems.FieldByName('AmtCr').AsFloat:=StrToFloatDef(FormatFloat('0.00;-0.00;0.0', StrToFloat(FloatToStr(aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat*UsdExRate))), 0);
dmAcc.AdotblVouItems.FieldByName('AmtDr').AsFloat:=0.00;
if bsSkinCheckRadioBox7.Checked then
Amt:=Amt+StrToFloatDef(FormatFloat('0.00;-0.00;0.0', StrToFloat(FloatToStr(aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat*aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat))), 0)
else
Amt:=Amt+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:=AccInfo.CreditAccID;
dmAcc.AdotblVouItems.FieldByName('AmtCr').AsFloat:=StrToFloatDef(FormatFloat('0.00;-0.00;0.0',aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat),0);
dmAcc.AdotblVouItems.FieldByName('AmtDr').AsFloat:=0.00;
dmAcc.AdotblVouItems.FieldByName('FCYCR').AsFloat:=0.0;
dmAcc.AdotblVouItems.FieldByName('FCYDr').AsFloat:=0.0;
dmAcc.AdotblVouItems.FieldByName('FCYEXRATE').AsFloat:=0.0;
Amt:=Amt+StrToFloatDef(FormatFloat('0.00;-0.00;0.0', aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat), 0);
end;
explan:='';
if t_cw_design.fieldbyname('<27><><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6>ժҪ').AsString<>'' then
begin
explan:=getstrfromdataset(aQuery,t_cw_design.fieldByName('<27><><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6>ժҪ').AsString);
end
else
begin
explan:=get_strInvoice(aQuery);
end;
dmAcc.AdotblVouItems.FieldByName('EXPLAN').AsString:=explan;
dmAcc.AdotblVouItems.FieldByName('CorpID').AsString:=GetCustID(aQuery.fieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString,aQuery.fieldbyname('<27>ո<EFBFBD>').AsString);
dmAcc.AdotblVouItems.FieldByName('CorpBf').AsString:='F';
case t_cw_design.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsInteger of
0:
if t_cw_design.fieldbyname('<27><><EFBFBD><EFBFBD><E1B5A5>').asboolean then
dmAcc.AdotblVouItems.FieldByName('BSNO').AsString:=aQuery.fieldByName('<27><><EFBFBD><EFBFBD><E1B5A5>').AsString;
1:
if t_cw_design.fieldbyname('ί<>б<EFBFBD><D0B1><EFBFBD>').asboolean then
dmAcc.AdotblVouItems.FieldByName('BSNO').AsString:=aQuery.fieldByName('ί<>б<EFBFBD><D0B1><EFBFBD>').AsString;
2:
if t_cw_design.fieldbyname('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asboolean then
dmAcc.AdotblVouItems.FieldByName('BSNO').AsString:=aQuery.fieldByName('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString
end;
dmAcc.AdotblVouItems.Post;
aQuery.next;
end;
if Amt<>fDataSet.fieldbyName('ʵ<>ʽ<EFBFBD><CABD><EFBFBD>').AsFloat+fDataSet.fieldbyName('<27><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD>').AsFloat then
begin
dmAcc.AdotblVouItems.Insert;
// dmAcc.AdotblVouItems.FieldByName('QTYSPECS').AsString:=AccInfo.CustKindName;
dmAcc.AdotblVouItems.FieldByName('AccID').AsString:=AccInfo.ExchangeGLID;
dmAcc.AdotblVouItems.FieldByName('Amtdr').AsFloat:=StrToFloatDef(FormatFloat('0.00;-0.00;0.0',Amt-fDataSet.fieldbyName('ʵ<>ʽ<EFBFBD><CABD><EFBFBD>').AsFloat-fDataSet.fieldbyName('<27><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD>').AsFloat),0);
dmAcc.AdotblVouItems.FieldByName('Amtcr').AsFloat:=0.00;
dmAcc.AdotblVouItems.FieldByName('FCYCR').AsFloat:=0.0;
dmAcc.AdotblVouItems.FieldByName('FCYDr').AsFloat:=0.0;
dmAcc.AdotblVouItems.FieldByName('FCYEXRATE').AsFloat:=0.0;
explan:='';
if t_cw_design.fieldbyname('<27><>Ӫҵ<D3AA><D2B5><EFBFBD>ɱ<EFBFBD>ժҪ').AsString<>'' then
begin
explan:=getstrfromdataset(aQuery,t_cw_design.fieldByName('<27><>Ӫҵ<D3AA><D2B5><EFBFBD>ɱ<EFBFBD>ժҪ').AsString);
end
else
begin
explan:=get_strInvoice(aQuery);
end;
dmAcc.AdotblVouItems.FieldByName('EXPLAN').AsString:=explan;
dmAcc.AdotblVouItems.FieldByName('CorpID').AsString:=GetCustID(aQuery.fieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString,aQuery.fieldbyname('<27>ո<EFBFBD>').AsString);
dmAcc.AdotblVouItems.FieldByName('CorpBf').AsString:='F';
case t_cw_design.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsInteger of
0:
if t_cw_design.fieldbyname('<27><><EFBFBD><EFBFBD><E1B5A5>').asboolean then
dmAcc.AdotblVouItems.FieldByName('BSNO').AsString:=aQuery.fieldByName('<27><><EFBFBD><EFBFBD><E1B5A5>').AsString;
1:
if t_cw_design.fieldbyname('ί<>б<EFBFBD><D0B1><EFBFBD>').asboolean then
dmAcc.AdotblVouItems.FieldByName('BSNO').AsString:=aQuery.fieldByName('ί<>б<EFBFBD><D0B1><EFBFBD>').AsString;
2:
if t_cw_design.fieldbyname('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asboolean then
dmAcc.AdotblVouItems.FieldByName('BSNO').AsString:=aQuery.fieldByName('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString
end;
dmAcc.AdotblVouItems.Post;
end;
ordno:=dmAcc.AdotblVou.fieldbyname('ordno').asinteger;
finally
FreeAndNil(aQuery);
end;
end;
}
function Tfrm_cw_pingzheng_gj.NewDrCrInv(fDataSet:TDataSet;Mblno,ZDR:String;voudate:TDate):String;
var
Dr,Cr,UDr,UCr,UDrttl,UCrttl,UsdExrate,r_Taxes_inccome,Amt:Real;
OrdNo:integer;
aPeriod:String;
begin
Result:='';
Dr:=0.0;
Cr:=0.0;
UDr:=0.0;
UCr:=0.0;
r_Taxes_inccome:=0.0;
Amt:=0.0;
if fDataSet.FieldByName('<27>ұ<EFBFBD>').AsString='RMB' then
UsdExRate:=1
else UsdExRate:=StrToFloatDef(Edit10.Text,7.8);
try
dmAcc.AdotblVou.Insert;
dmAcc.AdotblVou.FieldByName('SourceType').AsInteger:=1;
dmAcc.AdotblVou.FieldByName('ATTACHS').AsInteger:=AccInfo.ATTACHS;
if Trim(AccInfo.TransName)<>'' then
dmAcc.AdotblVou.FieldByName('VKNO').AsString:=AccInfo.TransName
else dmAcc.AdotblVou.FieldByName('VKNO').AsString:='<27><>';
dmAcc.AdotblVou.FieldByName('PREPARED').AsString:=RxDBLookupCombo6.DisplayValues[0];
dmAcc.AdotblVou.Post;
dmAcc.AdotblVou.Edit;
OrdNo:=dmAcc.AdotblVou.fieldByName('OrdNo').AsInteger;
Result:=dmAcc.AdotblVou.fieldByName('VOUNO').AsString;
dmAcc.AdotblVouItems.Insert;
if fDataSet.FieldByName('<27>ұ<EFBFBD>').AsString='USD' then
begin
dmAcc.AdotblVouItems.FieldByName('AccID').AsString:=AccInfo.DebitAccIDU;
dmAcc.AdotblVouItems.FieldByName('FCYEXRATE').AsFloat:=UsdExRate;
dmAcc.AdotblVouItems.FieldByName('FCYDR').AsFloat:=StrToFloatDef(FormatFloat('0.00;-0.00;0.0', fDataSet.fieldByName('<27>ϼƽ<CFBC><C6BD><EFBFBD>').AsFloat), 0);
dmAcc.AdotblVouItems.FieldByName('FCYCr').AsFloat:=0.0;
dmAcc.AdotblVouItems.FieldByName('FCYNO').AsString:='USD';
dmAcc.AdotblVouItems.FieldByName('AmtDr').AsFloat:=StrToFloatDef(FormatFloat('0.00;-0.00;0.0', fDataSet.fieldByName('<27>ϼƽ<CFBC><C6BD><EFBFBD>').AsFloat*UsdExRate), 0);
dmAcc.AdotblVouItems.FieldByName('AmtCr').AsFloat:=0.0;
end
else
begin
dmAcc.AdotblVouItems.FieldByName('AccID').AsString:=AccInfo.DebitAccID;
dmAcc.AdotblVouItems.FieldByName('AmtDr').AsFloat:=StrToFloatDef(FormatFloat('0.00;-0.00;0.0',fDataSet.fieldByName('<27>ϼƽ<CFBC><C6BD><EFBFBD>').AsFloat),0);
dmAcc.AdotblVouItems.FieldByName('AmtCr').AsFloat:=0.0;
dmAcc.AdotblVouItems.FieldByName('FCYNO').AsString:='RMB';
dmAcc.AdotblVouItems.FieldByName('FCYDR').AsFloat:=0.0;
dmAcc.AdotblVouItems.FieldByName('FCYCr').AsFloat:=0.0;
dmAcc.AdotblVouItems.FieldByName('FCYEXRATE').AsFloat:=0.0;
end;
dmAcc.AdotblVouItems.FieldByName('EXPLAN').AsString:=fDataSet.fieldByName('<27><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD>').AsString;
dmAcc.AdotblVouItems.FieldByName('CorpID').AsString:=GetCustID(fDataSet.fieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString,'<27><>');
dmAcc.AdotblVouItems.FieldByName('QTYSPECS').AsString:=AccInfo.CustKindName; // <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>
dmAcc.AdotblVouItems.FieldByName('CorpBf').AsString:='F';
dmAcc.AdotblVouItems.FieldByName('DEPTID').AsString:='';
dmAcc.AdotblVouItems.FieldByName('EMPLID').AsString:='';
dmAcc.AdotblVouItems.FieldByName('BSNO').AsString:=fDataSet.fieldByName('<27><EFBFBD><E1B5A5>').AsString;
dmAcc.AdotblVouItems.Post;
Amt:=StrToFloatDef(FormatFloat('0.00;-0.00;0.0', fDataSet.fieldByName('<27>ϼƽ<CFBC><C6BD><EFBFBD>').AsFloat*UsdExRate), 0);
r_Taxes_inccome:=StrToFloatDef(FormatFloat('0.00;-0.00;0.0', (Amt/(1+vat_value/100))*vat_value/100), 0);
if r_Taxes_inccome=0 then
begin
dmAcc.AdotblVouItems.Insert;
if fDataSet.FieldByName('<27>ұ<EFBFBD>').AsString='USD' then
begin
dmAcc.AdotblVouItems.FieldByName('AccID').AsString:=AccInfo.ProfitAccIDU;
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',fDataSet.fieldByName('<27>ϼƽ<CFBC><C6BD><EFBFBD>').AsFloat), 0);
dmAcc.AdotblVouItems.FieldByName('FCYNO').AsString:='USD';
dmAcc.AdotblVouItems.FieldByName('AmtCr').AsFloat:=StrToFloatDef(FormatFloat('0.00;-0.00;0.0', fDataSet.fieldByName('<27>ϼƽ<CFBC><C6BD><EFBFBD>').AsFloat*UsdExRate), 0);
dmAcc.AdotblVouItems.FieldByName('AmtDr').AsFloat:=0.0;
end
else
begin
dmAcc.AdotblVouItems.FieldByName('AccID').AsString:=AccInfo.ProfitAccID;
dmAcc.AdotblVouItems.FieldByName('AmtDr').AsFloat:=0.0;
dmAcc.AdotblVouItems.FieldByName('FCYNO').AsString:='RMB';
dmAcc.AdotblVouItems.FieldByName('FCYDR').AsFloat:=0.0;
dmAcc.AdotblVouItems.FieldByName('FCYCr').AsFloat:=0.0;
dmAcc.AdotblVouItems.FieldByName('FCYEXRATE').AsFloat:=0.0;
dmAcc.AdotblVouItems.FieldByName('AmtCr').AsFloat:=StrToFloatDef(FormatFloat('0.00;-0.00;0.0', fDataSet.fieldByName('<27>ϼƽ<CFBC><C6BD><EFBFBD>').AsFloat), 0);
dmAcc.AdotblVouItems.FieldByName('AmtDr').AsFloat:=0.0;
end;
dmAcc.AdotblVouItems.FieldByName('EXPLAN').AsString:='<27><><EFBFBD><EFBFBD> '+fDataSet.fieldByName('<27><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD>').AsString;
dmAcc.AdotblVouItems.FieldByName('BSNO').AsString:=fDataSet.fieldByName('<27><EFBFBD><E1B5A5>').AsString;
dmAcc.AdotblVouItems.Post;
end
else
begin
if fDataSet.FieldByName('<27>ұ<EFBFBD>').AsString='USD' then
begin
dmAcc.AdotblVouItems.Insert;
dmAcc.AdotblVouItems.FieldByName('AccID').AsString:=AccInfo.ProfitAccIDU;
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',fDataSet.fieldByName('<27>ϼƽ<CFBC><C6BD><EFBFBD>').AsFloat), 0);
dmAcc.AdotblVouItems.FieldByName('FCYNO').AsString:='USD';
Amt:=StrToFloatDef(FormatFloat('0.00;-0.00;0.0', fDataSet.fieldByName('<27>ϼƽ<CFBC><C6BD><EFBFBD>').AsFloat*UsdExRate), 0);
r_Taxes_inccome:=StrToFloatDef(FormatFloat('0.00;-0.00;0.0', (Amt/(1+vat_value/100))*vat_value/100), 0);
dmAcc.AdotblVouItems.FieldByName('AmtCr').AsString:=FormatFloat('0.00;-0.00;0',Amt-r_Taxes_inccome);
dmAcc.AdotblVouItems.FieldByName('AmtDr').AsFloat:=0.0;
dmAcc.AdotblVouItems.FieldByName('EXPLAN').AsString:='<27><><EFBFBD><EFBFBD> '+fDataSet.fieldByName('<27><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD>').AsString;
dmAcc.AdotblVouItems.FieldByName('BSNO').AsString:=fDataSet.fieldByName('<27><EFBFBD><E1B5A5>').AsString;
dmAcc.AdotblVouItems.Post;
if r_Taxes_inccome<>0 then
begin
dmAcc.AdotblVouItems.Insert;
dmAcc.AdotblVouItems.FieldByName('AccID').AsString:=AccInfo.Taxes_Income;
Amt:=StrToFloatDef(FormatFloat('0.00;-0.00;0.0', fDataSet.fieldByName('<27>ϼƽ<CFBC><C6BD><EFBFBD>').AsFloat*UsdExRate), 0);
r_Taxes_inccome:=StrToFloatDef(FormatFloat('0.00;-0.00;0.0', (Amt/(1+vat_value/100))*vat_value/100), 0);
dmAcc.AdotblVouItems.FieldByName('AmtCr').AsFloat:=r_Taxes_inccome;
dmAcc.AdotblVouItems.FieldByName('AmtDr').AsFloat:=0.0;
dmAcc.AdotblVouItems.FieldByName('EXPLAN').AsString:='˰<><CBB0> '+fDataSet.fieldByName('<27><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD>').AsString;
dmAcc.AdotblVouItems.FieldByName('BSNO').AsString:=fDataSet.fieldByName('<27><EFBFBD><E1B5A5>').AsString;
dmAcc.AdotblVouItems.Post;
end;
end
else
begin
dmAcc.AdotblVouItems.Insert;
dmAcc.AdotblVouItems.FieldByName('AccID').AsString:=AccInfo.ProfitAccIDU;
dmAcc.AdotblVouItems.FieldByName('FCYNO').AsString:='RMB';
Amt:=StrToFloatDef(FormatFloat('0.00;-0.00;0.0', fDataSet.fieldByName('<27>ϼƽ<CFBC><C6BD><EFBFBD>').AsFloat), 0);
r_Taxes_inccome:=StrToFloatDef(FormatFloat('0.00;-0.00;0.0', (Amt/(1+vat_value/100))*vat_value/100), 0);
dmAcc.AdotblVouItems.FieldByName('AmtCr').AsString:=FormatFloat('0.00;-0.00;0',Amt-r_Taxes_inccome);
dmAcc.AdotblVouItems.FieldByName('AmtDr').AsFloat:=0.0;
dmAcc.AdotblVouItems.FieldByName('EXPLAN').AsString:='<27><><EFBFBD><EFBFBD> '+fDataSet.fieldByName('<27><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD>').AsString;
dmAcc.AdotblVouItems.FieldByName('BSNO').AsString:=fDataSet.fieldByName('<27><EFBFBD><E1B5A5>').AsString;
dmAcc.AdotblVouItems.Post;
if r_Taxes_inccome<>0 then
begin
dmAcc.AdotblVouItems.Insert;
dmAcc.AdotblVouItems.FieldByName('AccID').AsString:=AccInfo.Taxes_Income;
Amt:=StrToFloatDef(FormatFloat('0.00;-0.00;0.0', fDataSet.fieldByName('<27>ϼƽ<CFBC><C6BD><EFBFBD>').AsFloat), 0);
r_Taxes_inccome:=StrToFloatDef(FormatFloat('0.00;-0.00;0.0', (Amt/(1+vat_value/100))*vat_value/100), 0);
dmAcc.AdotblVouItems.FieldByName('AmtCr').AsFloat:=r_Taxes_inccome;
dmAcc.AdotblVouItems.FieldByName('AmtDr').AsFloat:=0.0;
dmAcc.AdotblVouItems.FieldByName('EXPLAN').AsString:='˰<><CBB0> '+fDataSet.fieldByName('<27><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD>').AsString;
dmAcc.AdotblVouItems.FieldByName('BSNO').AsString:=fDataSet.fieldByName('<27><EFBFBD><E1B5A5>').AsString;
dmAcc.AdotblVouItems.Post;
end;
end;
end;
ordno:=dmAcc.AdotblVou.fieldbyname('ordno').asinteger;
finally
end;
end;
function Tfrm_cw_pingzheng_gj.NewDrCrInvCr(fDataSet:TDataSet;Mblno,ZDR:String;voudate:TDate):String;
var
Dr,Cr,UDr,UCr,UDrttl,UCrttl,UsdExrate,r_Taxes_inccome,Amt,OrgAmt:Real;
OrdNo:integer;
aPeriod:String;
begin
Result:='';
Dr:=0.0;
Cr:=0.0;
UDr:=0.0;
UCr:=0.0;
r_Taxes_inccome:=0.0;
Amt:=0.0;
if fDataSet.FieldByName('<27>ұ<EFBFBD>').AsString='RMB' then
UsdExRate:=1
else UsdExRate:=StrToFloatDef(Edit10.Text,7.8);
try
OrdNo:=dmAcc.AdotblVou.fieldByName('OrdNo').AsInteger;
Result:=dmAcc.AdotblVou.fieldByName('VOUNO').AsString;
OrgAmt:=StrToFloatDef(FormatFloat('0.00;-0.00;0.0', fDataSet.fieldByName('ʵ<>ʽ<EFBFBD><CABD><EFBFBD>').AsFloat), 0);
Amt:=StrToFloatDef(FormatFloat('0.00;-0.00;0.0', fDataSet.fieldByName('ʵ<>ʽ<EFBFBD><CABD><EFBFBD>').AsFloat*UsdExRate), 0);
r_Taxes_inccome:=StrToFloatDef(FormatFloat('0.00;-0.00;0.0', (Amt/(1+vat_value/100))*vat_value/100), 0);
if r_Taxes_inccome=0 then
begin
if fDataSet.FieldByName('<27>ұ<EFBFBD>').AsString='USD' then
begin
dmAcc.AdotblVouItems.Insert;
dmAcc.AdotblVouItems.FieldByName('AccID').AsString:=AccInfo.ImpProfitAccIDU;
dmAcc.AdotblVouItems.FieldByName('FCYEXRATE').AsFloat:=UsdExRate;
dmAcc.AdotblVouItems.FieldByName('FCYDr').AsFloat:=StrToFloatDef(FormatFloat('0.00;-0.00;0.0',OrgAmt), 0);
dmAcc.AdotblVouItems.FieldByName('FCYCR').AsFloat:=0.0;
dmAcc.AdotblVouItems.FieldByName('FCYNO').AsString:='USD';
dmAcc.AdotblVouItems.FieldByName('AmtDr').AsFloat:=Amt;
dmAcc.AdotblVouItems.FieldByName('AmtCr').AsFloat:=0.0;
dmAcc.AdotblVouItems.FieldByName('EXPLAN').AsString:='<27>ɱ<EFBFBD> '+fDataSet.fieldByName('<27><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD>').AsString;
dmAcc.AdotblVouItems.FieldByName('BSNO').AsString:=fDataSet.fieldByName('<27><EFBFBD><E1B5A5>').AsString;
dmAcc.AdotblVouItems.Post;
dmAcc.AdotblVouItems.Insert;
dmAcc.AdotblVouItems.FieldByName('AccID').AsString:=AccInfo.CreditAccIDU;
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',OrgAmt), 0);
dmAcc.AdotblVouItems.FieldByName('FCYNO').AsString:='USD';
dmAcc.AdotblVouItems.FieldByName('AmtDr').AsFloat:=0.0;
dmAcc.AdotblVouItems.FieldByName('AmtCr').AsFloat:=Amt;
dmAcc.AdotblVouItems.FieldByName('CorpID').AsString:=GetCustID(fDataSet.fieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString,'<27><>');
dmAcc.AdotblVouItems.FieldByName('EXPLAN').AsString:='Ӧ<><D3A6> '+fDataSet.fieldByName('<27><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD>').AsString;
dmAcc.AdotblVouItems.FieldByName('BSNO').AsString:=fDataSet.fieldByName('<27><EFBFBD><E1B5A5>').AsString;
dmAcc.AdotblVouItems.Post;
end
else
begin
dmAcc.AdotblVouItems.Insert;
dmAcc.AdotblVouItems.FieldByName('AccID').AsString:=AccInfo.ImpProfitAccID;
dmAcc.AdotblVouItems.FieldByName('FCYEXRATE').AsFloat:=UsdExRate;
dmAcc.AdotblVouItems.FieldByName('FCYDr').AsFloat:=0;
dmAcc.AdotblVouItems.FieldByName('FCYCR').AsFloat:=0.0;
dmAcc.AdotblVouItems.FieldByName('FCYNO').AsString:='RMB';
dmAcc.AdotblVouItems.FieldByName('AmtDr').AsFloat:=Amt;
dmAcc.AdotblVouItems.FieldByName('AmtCr').AsFloat:=0.0;
dmAcc.AdotblVouItems.FieldByName('EXPLAN').AsString:='<27>ɱ<EFBFBD> '+fDataSet.fieldByName('<27><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD>').AsString;
dmAcc.AdotblVouItems.FieldByName('BSNO').AsString:=fDataSet.fieldByName('<27><EFBFBD><E1B5A5>').AsString;
dmAcc.AdotblVouItems.Post;
dmAcc.AdotblVouItems.Insert;
dmAcc.AdotblVouItems.FieldByName('AccID').AsString:=AccInfo.CreditAccID;
dmAcc.AdotblVouItems.FieldByName('FCYDR').AsFloat:=0.0;
dmAcc.AdotblVouItems.FieldByName('FCYCr').AsFloat:=0;
dmAcc.AdotblVouItems.FieldByName('FCYNO').AsString:='RMB';
dmAcc.AdotblVouItems.FieldByName('AmtDr').AsFloat:=0.0;
dmAcc.AdotblVouItems.FieldByName('AmtCr').AsFloat:=Amt;
dmAcc.AdotblVouItems.FieldByName('CorpID').AsString:=GetCustID(fDataSet.fieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString,'<27><>');
dmAcc.AdotblVouItems.FieldByName('EXPLAN').AsString:='Ӧ<><D3A6> '+fDataSet.fieldByName('<27><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD>').AsString;
dmAcc.AdotblVouItems.FieldByName('BSNO').AsString:=fDataSet.fieldByName('<27><EFBFBD><E1B5A5>').AsString;
dmAcc.AdotblVouItems.Post;
end;
end
else
begin
if fDataSet.FieldByName('<27>ұ<EFBFBD>').AsString='USD' then
begin
dmAcc.AdotblVouItems.Insert;
dmAcc.AdotblVouItems.FieldByName('AccID').AsString:=AccInfo.ImpProfitAccIDU;
dmAcc.AdotblVouItems.FieldByName('FCYEXRATE').AsFloat:=UsdExRate;
dmAcc.AdotblVouItems.FieldByName('FCYDr').AsFloat:=StrToFloatDef(FormatFloat('0.00;-0.00;0.0',(Amt-r_Taxes_inccome)/UsdExRate), 0);
dmAcc.AdotblVouItems.FieldByName('FCYCR').AsFloat:=0.0;
dmAcc.AdotblVouItems.FieldByName('FCYNO').AsString:='USD';
dmAcc.AdotblVouItems.FieldByName('AmtDr').AsFloat:=Amt-r_Taxes_inccome;
dmAcc.AdotblVouItems.FieldByName('AmtCr').AsFloat:=0.0;
dmAcc.AdotblVouItems.FieldByName('EXPLAN').AsString:='<27>ɱ<EFBFBD> '+fDataSet.fieldByName('<27><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD>').AsString;
dmAcc.AdotblVouItems.FieldByName('BSNO').AsString:=fDataSet.fieldByName('<27><EFBFBD><E1B5A5>').AsString;
dmAcc.AdotblVouItems.Post;
if r_Taxes_inccome<>0 then
begin
dmAcc.AdotblVouItems.Insert;
dmAcc.AdotblVouItems.FieldByName('AccID').AsString:=AccInfo.Taxes_Cost;
dmAcc.AdotblVouItems.FieldByName('FCYDr').AsFloat:=r_Taxes_inccome;
dmAcc.AdotblVouItems.FieldByName('FCYCR').AsFloat:=0.0;
dmAcc.AdotblVouItems.FieldByName('FCYNO').AsString:='RMB';
dmAcc.AdotblVouItems.FieldByName('AmtDr').AsFloat:=r_Taxes_inccome;
dmAcc.AdotblVouItems.FieldByName('AmtCr').AsFloat:=0.0;
dmAcc.AdotblVouItems.FieldByName('EXPLAN').AsString:='˰<><CBB0> '+fDataSet.fieldByName('<27><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD>').AsString;
dmAcc.AdotblVouItems.FieldByName('BSNO').AsString:=fDataSet.fieldByName('<27><EFBFBD><E1B5A5>').AsString;
dmAcc.AdotblVouItems.Post;
end;
dmAcc.AdotblVouItems.Insert;
dmAcc.AdotblVouItems.FieldByName('AccID').AsString:=AccInfo.CreditAccIDU;
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',OrgAmt), 0);
dmAcc.AdotblVouItems.FieldByName('FCYNO').AsString:='USD';
dmAcc.AdotblVouItems.FieldByName('AmtDr').AsFloat:=0.0;
dmAcc.AdotblVouItems.FieldByName('AmtCr').AsFloat:=Amt;
dmAcc.AdotblVouItems.FieldByName('CorpID').AsString:=GetCustID(fDataSet.fieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString,'<27><>');
dmAcc.AdotblVouItems.FieldByName('EXPLAN').AsString:='Ӧ<><D3A6> '+fDataSet.fieldByName('<27><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD>').AsString;
dmAcc.AdotblVouItems.FieldByName('BSNO').AsString:=fDataSet.fieldByName('<27><EFBFBD><E1B5A5>').AsString;
dmAcc.AdotblVouItems.Post;
end
else
begin
dmAcc.AdotblVouItems.Insert;
dmAcc.AdotblVouItems.FieldByName('AccID').AsString:=AccInfo.ImpProfitAccID;
dmAcc.AdotblVouItems.FieldByName('FCYEXRATE').AsFloat:=1;
dmAcc.AdotblVouItems.FieldByName('FCYNO').AsString:='RMB';
dmAcc.AdotblVouItems.FieldByName('AmtDr').AsFloat:=Amt-r_Taxes_inccome;
dmAcc.AdotblVouItems.FieldByName('AmtCr').AsFloat:=0.0;
dmAcc.AdotblVouItems.FieldByName('EXPLAN').AsString:='<27>ɱ<EFBFBD> '+fDataSet.fieldByName('<27><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD>').AsString;
dmAcc.AdotblVouItems.FieldByName('BSNO').AsString:=fDataSet.fieldByName('<27><EFBFBD><E1B5A5>').AsString;
dmAcc.AdotblVouItems.Post;
if r_Taxes_inccome<>0 then
begin
dmAcc.AdotblVouItems.Insert;
dmAcc.AdotblVouItems.FieldByName('AccID').AsString:=AccInfo.Taxes_Cost;
dmAcc.AdotblVouItems.FieldByName('FCYEXRATE').AsFloat:=1;
dmAcc.AdotblVouItems.FieldByName('FCYNO').AsString:='RMB';
dmAcc.AdotblVouItems.FieldByName('AmtDr').AsFloat:=r_Taxes_inccome;
dmAcc.AdotblVouItems.FieldByName('AmtCr').AsFloat:=0.0;
dmAcc.AdotblVouItems.FieldByName('EXPLAN').AsString:='˰<><CBB0> '+fDataSet.fieldByName('<27><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD>').AsString;
dmAcc.AdotblVouItems.FieldByName('BSNO').AsString:=fDataSet.fieldByName('<27><EFBFBD><E1B5A5>').AsString;
dmAcc.AdotblVouItems.Post;
end;
dmAcc.AdotblVouItems.Insert;
dmAcc.AdotblVouItems.FieldByName('AccID').AsString:=AccInfo.CreditAccID;
dmAcc.AdotblVouItems.FieldByName('FCYEXRATE').AsFloat:=1;
dmAcc.AdotblVouItems.FieldByName('FCYNO').AsString:='RMB';
dmAcc.AdotblVouItems.FieldByName('AmtDr').AsFloat:=0.0;
dmAcc.AdotblVouItems.FieldByName('AmtCr').AsFloat:=Amt;
dmAcc.AdotblVouItems.FieldByName('CorpID').AsString:=GetCustID(fDataSet.fieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString,'<27><>');
dmAcc.AdotblVouItems.FieldByName('EXPLAN').AsString:='Ӧ<><D3A6> '+fDataSet.fieldByName('<27><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD>').AsString;
dmAcc.AdotblVouItems.FieldByName('BSNO').AsString:=fDataSet.fieldByName('<27><EFBFBD><E1B5A5>').AsString;
dmAcc.AdotblVouItems.Post;
end;
end;
ordno:=dmAcc.AdotblVou.fieldbyname('ordno').asinteger;
finally
end;
end;
procedure Tfrm_cw_pingzheng_gj.CreateMemTbl;
begin
memTblVou.Close;
memTblVou.Fields.Clear;
with memTblVou.FieldDefs do begin
Clear;
Add('Selected', ftsmallint, 0, false);
Add('status', ftsmallint, 0, false);
Add('VOUDATE', ftDate, 0, false);
Add('accyear', ftinteger, 0, false);
Add('AccMonth', ftsmallint, 0, false);
Add('VKNO', ftString, 8, false);
Add('VOUNO',ftString,16,false);
Add('ORDNO', ftinteger, 0, false);
Add('AMTDR', ftFloat, 0, false);
Add('AMTCR', ftFloat, 0, false);
Add('ATTACHS', ftinteger, 0, false);
Add('SourceType', ftinteger, 0, false);
Add('PREPARED', ftString,10, false);
memTblVou.CreateTable;
end;
end;
function Tfrm_cw_pingzheng_gj.cw_client_yingshou_error():boolean;
begin
end;
function Tfrm_cw_pingzheng_gj.cw_client_yingfu_error():boolean;
begin
end;
function Tfrm_cw_pingzheng_gj.cw_client_shouru_error():boolean;
begin
end;
function Tfrm_cw_pingzheng_gj.cw_client_chengben_error():boolean;
begin
end;
function Tfrm_cw_pingzheng_gj.get_str(i:integer;Dc,CorpName:string;data:TDataSet):widestring;
begin
result:='';
if t_cw_design.fieldbyname('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asboolean then
begin
if Trim(result)='' then result:=data.fieldbyname('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring
else result:=result+' '+data.fieldbyname('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring;
end;
if t_cw_design.fieldbyname('ί<>б<EFBFBD><D0B1><EFBFBD>').asboolean then
begin
if Trim(result)='' then result:=data.fieldbyname('ί<>б<EFBFBD><D0B1><EFBFBD>').asstring
else result:=result+' '+data.fieldbyname('ί<>б<EFBFBD><D0B1><EFBFBD>').asstring;
end;
case i of
1:
begin
if t_cw_design.fieldbyname('<27><><EFBFBD><EFBFBD><E1B5A5>').asboolean then
begin
if Trim(result)='' then result:=data.fieldbyname('<27><><EFBFBD><EFBFBD><E1B5A5>').asstring
else result:=result+' '+data.fieldbyname('<27><><EFBFBD><EFBFBD><E1B5A5>').asstring;
end;
if t_cw_design.fieldbyname('<27><><EFBFBD><EFBFBD>').asboolean then
begin
if Trim(result)='' then result:=data.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring
else result:=result+' '+data.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring;
end;
if t_cw_design.fieldbyname('<27><><EFBFBD><EFBFBD>').asboolean then
begin
if Trim(result)='' then result:=data.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring
else result:=result+' '+data.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring;
end;
if t_cw_design.fieldbyname('<27><><EFBFBD><EFBFBD>').asboolean then
begin
if Trim(result)='' then result:=data.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring
else result:=result+' '+data.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring;
end;
end;
2:
begin
if t_cw_design.fieldbyname('<27><><EFBFBD><EFBFBD><E1B5A5>').asboolean then
begin
if Trim(result)='' then result:=data.fieldbyname('<27><><EFBFBD><EFBFBD><E1B5A5>').asstring
else result:=result+' '+data.fieldbyname('<27><><EFBFBD><EFBFBD><E1B5A5>').asstring;
end;
if t_cw_design.fieldbyname('<27><><EFBFBD><EFBFBD>').asboolean then
begin
if Trim(result)='' then result:=data.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring
else result:=result+' '+data.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring;
end;
if t_cw_design.fieldbyname('<27><><EFBFBD><EFBFBD>').asboolean then
begin
if Trim(result)='' then result:=data.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring
else result:=result+' '+data.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring;
end;
if t_cw_design.fieldbyname('<27><><EFBFBD><EFBFBD>').asboolean then
begin
if Trim(result)='' then result:=data.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring
else result:=result+' '+data.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring;
end;
end;
3:
begin
if t_cw_design.fieldbyname('<27><><EFBFBD><EFBFBD><E1B5A5>').asboolean then
begin
if Trim(result)='' then result:=data.fieldbyname('<27><><EFBFBD>˵<EFBFBD><CBB5><EFBFBD>').asstring
else result:=result+' '+data.fieldbyname('<27><><EFBFBD>˵<EFBFBD><CBB5><EFBFBD>').asstring;
end;
if t_cw_design.fieldbyname('<27><><EFBFBD><EFBFBD>').asboolean then
begin
if Trim(result)='' then result:=data.fieldbyname('һ<>̿<EFBFBD><CCBF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring
else result:=result+' '+data.fieldbyname('һ<>̿<EFBFBD><CCBF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring;
end;
if t_cw_design.fieldbyname('<27><><EFBFBD><EFBFBD>').asboolean then
begin
if Trim(result)='' then result:=data.fieldbyname('һ<>̺<EFBFBD><CCBA><EFBFBD>').asstring
else result:=result+' '+data.fieldbyname('һ<>̺<EFBFBD><CCBA><EFBFBD>').asstring;
end;
end;
4:
begin
if t_cw_design.fieldbyname('<27><><EFBFBD><EFBFBD><E1B5A5>').asboolean then
begin
if Trim(result)='' then result:=data.fieldbyname('<27><><EFBFBD>˵<EFBFBD><CBB5><EFBFBD>').asstring
else result:=result+' '+data.fieldbyname('<27><><EFBFBD>˵<EFBFBD><CBB5><EFBFBD>').asstring;
end;
if t_cw_design.fieldbyname('<27><><EFBFBD><EFBFBD>').asboolean then
begin
if Trim(result)='' then result:=data.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring
else result:=result+' '+data.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring;
end;
if t_cw_design.fieldbyname('<27><><EFBFBD><EFBFBD>').asboolean then
begin
if Trim(result)='' then result:=data.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring
else result:=result+' '+data.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring;
end;
end;
end;
if t_cw_design.fieldbyname('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').asboolean then
begin
if Dc<>'' then begin
result:=result+' '+Dc;
end;
if Trim(result)='' then result:=CorpName
else result:=result+' '+CorpName;
end;
end;
function Tfrm_cw_pingzheng_gj.get_strProfit(i:integer;data:TDataSet):widestring;
begin
result:='';
if t_cw_design.fieldbyname('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asboolean then
begin
if Trim(result)='' then result:=data.fieldbyname('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring
else result:=result+' '+data.fieldbyname('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring;
end;
if t_cw_design.fieldbyname('ί<>б<EFBFBD><D0B1><EFBFBD>').asboolean then
begin
if Trim(result)='' then result:=data.fieldbyname('ί<>б<EFBFBD><D0B1><EFBFBD>').asstring
else result:=result+' '+data.fieldbyname('ί<>б<EFBFBD><D0B1><EFBFBD>').asstring;
end;
case i of
1:
begin
if t_cw_design.fieldbyname('<27><><EFBFBD><EFBFBD><E1B5A5>').asboolean then
begin
if Trim(result)='' then result:=data.fieldbyname('<27><><EFBFBD><EFBFBD><E1B5A5>').asstring
else result:=result+' '+data.fieldbyname('<27><><EFBFBD><EFBFBD><E1B5A5>').asstring;
end;
if t_cw_design.fieldbyname('<27><><EFBFBD><EFBFBD>').asboolean then
begin
if Trim(result)='' then result:=data.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring
else result:=result+' '+data.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring;
end;
end;
2:
begin
if t_cw_design.fieldbyname('<27><><EFBFBD><EFBFBD><E1B5A5>').asboolean then
begin
if Trim(result)='' then result:=data.fieldbyname('<27><><EFBFBD><EFBFBD><E1B5A5>').asstring
else result:=result+' '+data.fieldbyname('<27><><EFBFBD><EFBFBD><E1B5A5>').asstring;
end;
if t_cw_design.fieldbyname('<27><><EFBFBD><EFBFBD>').asboolean then
begin
if Trim(result)='' then result:=data.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring
else result:=result+' '+data.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring;
end;
end;
3:
begin
if t_cw_design.fieldbyname('<27><><EFBFBD><EFBFBD><E1B5A5>').asboolean then
begin
if Trim(result)='' then result:=data.fieldbyname('<27><><EFBFBD>˵<EFBFBD><CBB5><EFBFBD>').asstring
else result:=result+' '+data.fieldbyname('<27><><EFBFBD>˵<EFBFBD><CBB5><EFBFBD>').asstring;
end;
if t_cw_design.fieldbyname('<27><><EFBFBD><EFBFBD>').asboolean then
begin
if Trim(result)='' then result:=data.fieldbyname('һ<>̿<EFBFBD><CCBF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring
else result:=result+' '+data.fieldbyname('һ<>̿<EFBFBD><CCBF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring;
end;
end;
4:
begin
if t_cw_design.fieldbyname('<27><><EFBFBD><EFBFBD><E1B5A5>').asboolean then
begin
if Trim(result)='' then result:=data.fieldbyname('<27><><EFBFBD>˵<EFBFBD><CBB5><EFBFBD>').asstring
else result:=result+' '+data.fieldbyname('<27><><EFBFBD>˵<EFBFBD><CBB5><EFBFBD>').asstring;
end;
if t_cw_design.fieldbyname('<27><><EFBFBD><EFBFBD>').asboolean then
begin
if Trim(result)='' then result:=data.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring
else result:=result+' '+data.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring;
end;
end;
end;
result:=result+' '+'<27><><EFBFBD><EFBFBD>'+' ';
end;
function Tfrm_cw_pingzheng_gj.get_strDc(data:TDataSet):widestring;
begin
result:=data.fieldbyname('<27>ո<EFBFBD>').asstring;
if t_cw_design.fieldbyname('<27>ո<EFBFBD>ҵ<EFBFBD><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asboolean then
begin
if Trim(result)='' then result:=data.fieldbyname('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring
else result:=result+' '+data.fieldbyname('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring;
end;
if t_cw_design.fieldbyname('<27>ո<EFBFBD>ί<EFBFBD>б<EFBFBD><D0B1><EFBFBD>').asboolean then
begin
if Trim(result)='' then result:=data.fieldbyname('ί<>б<EFBFBD><D0B1><EFBFBD>').asstring
else result:=result+' '+data.fieldbyname('ί<>б<EFBFBD><D0B1><EFBFBD>').asstring;
end;
if t_cw_design.fieldbyname('<27>ո<EFBFBD><D5B8><EFBFBD><EFBFBD><EFBFBD><E1B5A5>').asboolean then
begin
if Trim(result)='' then result:=data.fieldbyname('<27><><EFBFBD><EFBFBD><E1B5A5>').asstring
else result:=result+' '+data.fieldbyname('<27><><EFBFBD><EFBFBD><E1B5A5>').asstring;
end;
if t_cw_design.fieldbyname('<27>ո<EFBFBD><D5B8>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').asboolean then
begin
if Trim(result)='' then result:=data.fieldbyname('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').asstring
else result:=result+' '+data.fieldbyname('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').asstring;
end;
end;
function Tfrm_cw_pingzheng_gj.get_strInvoice(data:TDataSet):widestring;
begin
result:='';
if t_cw_design.fieldbyname('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asboolean then
begin
if Trim(result)='' then result:=data.fieldbyname('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring
else result:=result+' '+data.fieldbyname('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring;
end;
if t_cw_design.fieldbyname('ί<>б<EFBFBD><D0B1><EFBFBD>').asboolean then
begin
if Trim(result)='' then result:=data.fieldbyname('ί<>б<EFBFBD><D0B1><EFBFBD>').asstring
else result:=result+' '+data.fieldbyname('ί<>б<EFBFBD><D0B1><EFBFBD>').asstring;
end;
if t_cw_design.fieldbyname('<27><><EFBFBD><EFBFBD><E1B5A5>').asboolean then
begin
if Trim(result)='' then result:=data.fieldbyname('<27><><EFBFBD><EFBFBD><E1B5A5>').asstring
else result:=result+' '+data.fieldbyname('<27><><EFBFBD><EFBFBD><E1B5A5>').asstring;
end;
if t_cw_design.fieldbyname('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').asboolean then
begin
if Trim(result)='' then result:=data.fieldbyname('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').asstring
else result:=result+' '+data.fieldbyname('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').asstring;
end;
end;
function Tfrm_cw_pingzheng_gj.get_billStr(bsNo:string):string;
var
aQuery:TADOQuery;
begin
Result:='';
aQuery:=CreateAdoQuery;
with aQuery,SQL do
try
Close;Clear;
Add('Select Top 1 ί<>б<EFBFBD><D0B1><EFBFBD>,<2C><><EFBFBD><EFBFBD><E1B5A5>');
Add('from v_fee_balance_items ');
Add('where <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>='''+bsNo+'''');
Open;
Result:=FieldByName('ί<>б<EFBFBD><D0B1><EFBFBD>').AsString+' '+FieldByName('<27><><EFBFBD><EFBFBD><E1B5A5>').AsString;
finally
Free;
end;
end;
procedure Tfrm_cw_pingzheng_gj.cw_add_1(op_type:integer);
var
num_accept_rmb,num_accept_usd,num_accept_all,num_pay_rmb,num_pay_usd,num_pay_all:real;
bill_count:integer;
if_do:boolean;
get_date:Tdatetime;
begin
{
}
end;
procedure Tfrm_cw_pingzheng_gj.FormShow(Sender: TObject);
var
str:widestring;
begin
IF frm_data_share.t_code_currency.Locate('<27>ұ<EFBFBD>','USD',[])THEN
begin
Edit10.Text:=FloatToStr(frm_data_share.t_code_currency.fieldbyname('<27><><EFBFBD><EFBFBD>').asfloat);
end;
loadreggrid(dxdbgrid1,true,caption+'1');
loadreggrid(dxdbgrid2,true,caption+'2');
loadreggrid(dxdbgrid3,true,caption+'3');
loadreggrid(dxdbgrid4,true,caption+'4');
loadreggrid(dxdbgrid5,true,caption+'5');
loadreggrid(dxdbgrid6,true,caption+'6');
loadreggrid(dxdbgrid7,true,caption+'7');
loadreggrid(dxdbgrid8,true,caption+'8');
t_cw_design.open;
t_Accitems.Open;
AccInfo.ACCSys:=t_cw_design.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsInteger;
AccInfo.DebitAccID:=trim(t_cw_design.fieldbyname('Ӧ<><D3A6><EFBFBD>˿<EFBFBD>').AsString);
AccInfo.DebitAccIDU:=t_cw_design.fieldbyname('Ӧ<><D3A6><EFBFBD>˿<EFBFBD><CBBF><EFBFBD><EFBFBD><EFBFBD>').AsString;
AccInfo.CreditAccID:=t_cw_design.fieldbyname('Ӧ<><D3A6><EFBFBD>˿<EFBFBD>').AsString;
AccInfo.CreditAccIDU:=t_cw_design.fieldbyname('Ӧ<><D3A6><EFBFBD>˿<EFBFBD><CBBF><EFBFBD><EFBFBD><EFBFBD>').AsString;
AccInfo.ProfitAccID:=t_cw_design.fieldbyname('<27><>Ӫҵ<D3AA><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString;
AccInfo.ImpProfitAccID:=t_cw_design.fieldbyname('<27><>Ӫҵ<D3AA><D2B5>֧<EFBFBD><D6A7>').AsString;
AccInfo.ProfitAccIDU:=t_cw_design.fieldbyname('<27><>Ӫ<EFBFBD><D3AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString;
AccInfo.ImpProfitAccIDU:=t_cw_design.fieldbyname('<27><>Ӫ֧<D3AA><D6A7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString;
AccInfo.AirProfitAccID:=t_cw_design.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӫҵ<D3AA><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString;
AccInfo.AirImpProfitAccID:=t_cw_design.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӫҵ<D3AA><D2B5>֧<EFBFBD><D6A7>').AsString;
AccInfo.AirProfitAccIDU:=t_cw_design.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӫ<EFBFBD><D3AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString;
AccInfo.AirImpProfitAccIDU:=t_cw_design.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӫ֧<D3AA><D6A7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString;
AccInfo.Taxes_Income:=t_cw_design.fieldbyname('<27><><EFBFBD><EFBFBD>˰').AsString;
AccInfo.Taxes_Cost:=t_cw_design.fieldbyname('<27><><EFBFBD><EFBFBD>˰').AsString;
AccInfo.PreTaxes_Income:=t_cw_design.fieldbyname('Ԥ<><D4A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˰').AsString;
AccInfo.PreTaxes_Cost:=t_cw_design.fieldbyname('Ԥ<><D4A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˰').AsString;
AccInfo.ifPreTaxes:=t_cw_design.fieldbyname('<27>Ƿ<EFBFBD>Ԥ<EFBFBD><D4A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˰').AsBoolean;
AccInfo.ifvat:=t_cw_design.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ˰<D6B5><CBB0>¼').AsBoolean;
AccInfo.ExchangeGLID:=trim(t_cw_design.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString);
AccInfo.OtherDebitAccID:=trim(t_cw_design.fieldbyname('<27><><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6>').AsString);
AccInfo.OtherCreditAccID:=t_cw_design.fieldbyname('<27><><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6>').AsString;
AccInfo.AccItem:=t_cw_design.fieldbyname('ʹ<>ú<EFBFBD><C3BA><EFBFBD><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF><EFBFBD>ɷ<EFBFBD>¼').AsInteger;
AccInfo.ProfitFull:=t_cw_design.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD>취').AsInteger;
AccInfo.ICUSD:=t_cw_design.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD>ɱ<EFBFBD><C9B1>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ԫ').AsInteger;
AccInfo.TransName:=trim(t_cw_design.fieldbyname('ת<><D7AA>ƾ֤<C6BE><D6A4>').AsString);
AccInfo.CashDrName:=trim(t_cw_design.fieldbyname('<27>ֽ<EFBFBD><D6BD>տ<EFBFBD>ƾ֤<C6BE><D6A4>').AsString);
AccInfo.CashCrName:=trim(t_cw_design.fieldbyname('<27>ֽ𸶿<D6BD>ƾ֤<C6BE><D6A4>').AsString);
AccInfo.BankDrName:=trim(t_cw_design.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD>տ<EFBFBD>ƾ֤<C6BE><D6A4>').AsString);
AccInfo.BankCrName:=trim(t_cw_design.fieldbyname('<27><><EFBFBD>и<EFBFBD><D0B8><EFBFBD>ƾ֤<C6BE><D6A4>').AsString);
AccInfo.CustKindName:=trim(t_cw_design.fieldbyname('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString);
AccInfo.SuppKindName:=trim(t_cw_design.fieldbyname('<27><>Ӧ<EFBFBD>̺<EFBFBD><CCBA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString);
AccInfo.DeptKindName:=trim(t_cw_design.fieldbyname('<27><><EFBFBD>ź<EFBFBD><C5BA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString);
AccInfo.SaleKindName:=trim(t_cw_design.fieldbyname('<27><>Ա<EFBFBD><D4B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString);
AccInfo.ATTACHS:=t_cw_design.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsInteger;
CreateMemTbl;
wwDBDateTimePicker21.Date:=now;
RxDBLookupCombo6.DisplayValue:=employee;
{
with SQLConnectionAcc do begin
// Params.LoadFromFile(ExtractFilePath(ParamStr(0))+'Account.ini');
try
Connected:=true;
except
exit;
end;
end;
}
// tblObj.Open;
{ with SQLConnectionAcc2 do begin
// Params.LoadFromFile(ExtractFilePath(ParamStr(0))+'Account.ini');
try
Connected:=true;
except
exit;
end;
end;
tblitems2.Open;
}
// tblCustomer.Open;
// tblAgent.Open;
// tblAccID.Open;
end;
procedure Tfrm_cw_pingzheng_gj.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
savereggrid(dxdbgrid1,caption+'1');
savereggrid(dxdbgrid2,caption+'2');
savereggrid(dxdbgrid3,caption+'3');
savereggrid(dxdbgrid4,caption+'4');
savereggrid(dxdbgrid5,caption+'5');
savereggrid(dxdbgrid6,caption+'6');
savereggrid(dxdbgrid7,caption+'7');
savereggrid(dxdbgrid8,caption+'8');
tblVouitems.DatabaseName:='';
tblVouitems.TableName:='';
DatabaseVouitems.DatabaseName:='';
DatabaseVouitems.AliasName:='';
tblVouitems.Close;
DatabaseVouitems.Connected:=false;
DatabaseVouitems.KeepConnection:=false;
// tblVouitems.Free;
// DatabaseVouitems.Free;
DatabaseVouitems.CloseDataSets;
DatabaseVouitems.Destroy;
frm_cw_pingzheng_open:=false;
frm_cw_load_iflog:=false;
frm_cw_pingzheng_gj.Hide;
frm_cw_pingzheng_gj.ManualFloat(frm_cw_pingzheng_gj.BoundsRect);
frm_main.freeTabs('frm_cw_pingzheng_gj');
action:=cafree;
frm_cw_pingzheng_gj:=nil;
end;
procedure Tfrm_cw_pingzheng_gj.bsSkinPageControl1Change(Sender: TObject);
begin
if frm_cw_pingzheng_open then
begin
t_op_seae.close;
t_op_seai.close;
t_op_aire.close;
t_op_airi.close;
t_ch_invoice.close;
end;
end;
procedure Tfrm_cw_pingzheng_gj.bsSkinButton10Click(Sender: TObject);
var
str:widestring;
begin
str:='where <20><><EFBFBD><EFBFBD>״̬='+''''+'<27><><EFBFBD>÷<EFBFBD><C3B7><EFBFBD>'+'''';
// str:='where 1=1 ';
if not bsSkinCheckRadioBox1.Checked then
str:=str+' and (<28><><EFBFBD><EFBFBD> is null or <20><><EFBFBD><EFBFBD>=0)';
if Edit4.text<>'' then begin
if Edit11.text<>'' then
str:=str+' and ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>>='+''''+Edit4.text+''''+' and ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><='+''''+Edit11.text+''''
else
str:=str+' and ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD> like '+''''+'%'+Edit4.text+'%'+'''';
end;
if Edit16.text<>'' then begin
if Edit17.text<>'' then
str:=str+' and <20><><EFBFBD><EFBFBD>ƾ֤>='+''''+Edit16.text+''''+' and <20><><EFBFBD><EFBFBD>ƾ֤<='+''''+Edit17.text+''''
else
str:=str+' and <20><><EFBFBD><EFBFBD>ƾ֤ like '+''''+'%'+Edit16.text+'%'+'''';
end;
if RxDBLookupCombo4.DisplayValue<>''then
str:=str+' and <20><><EFBFBD>۲<EFBFBD><DBB2><EFBFBD>='+''''+RxDBLookupCombo4.DisplayValues[0]+'''';
if RxDBLookupCombo1.DisplayValue<>''then
str:=str+' and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>='+''''+RxDBLookupCombo1.DisplayValues[0]+'''';
if wwDBLookupCombo49.Text<>''then
str:=str+' and <20><><EFBFBD><EFBFBD>='+''''+wwDBLookupCombo49.Text+'''';
if Edit34.Text<>''then
str:=str+' and <20><><EFBFBD><EFBFBD>='+''''+Edit34.Text+'''';
if Edit41.Text<>''then
str:=str+' and ί<>б<EFBFBD><D0B1><EFBFBD>='+''''+Edit41.Text+'''';
if RxDBLookupCombo3.DisplayValue<>''then
str:=str+' and ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD> in (select distinct bsno from v_vouitems where prepared='+''''+RxDBLookupCombo3.DisplayValues[0]+''''+')';
if Edit2.text<>'' then
str:=str+' and <20><><EFBFBD><EFBFBD><E1B5A5> like '+''''+'%'+Edit2.text+'%'+'''';
if wwDBDateTimePicker1.text<>''then
str:=str+' and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>>='+''''+wwDBDateTimePicker1.text+'''';
if wwDBDateTimePicker2.text<>''then
str:=str+' and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><='+''''+wwDBDateTimePicker2.text+'''';
if wwDBDateTimePicker3.text<>''then
str:=str+' and <20><><EFBFBD><EFBFBD><EFBFBD>ڼ<EFBFBD>>='+''''+wwDBDateTimePicker3.text+'''';
if wwDBDateTimePicker4.text<>''then
str:=str+' and <20><><EFBFBD><EFBFBD><EFBFBD>ڼ<EFBFBD><='+''''+wwDBDateTimePicker4.text+'''';
if wwDBDateTimePicker28.text<>''then
str:=str+' and <20><><EFBFBD>÷<EFBFBD><C3B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>>='+''''+wwDBDateTimePicker28.text+'''';
if wwDBDateTimePicker29.text<>''then
str:=str+' and <20><><EFBFBD>÷<EFBFBD><C3B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><='+''''+wwDBDateTimePicker29.text+'''';
if Edit14.text<>'' then
str:=str+' and ί<>б<EFBFBD><D0B1><EFBFBD> like '+''''+'%'+Edit14.text+'%'+'''';
t_op_seae.close;
t_op_seae.sql.clear;
t_op_seae.sql.add('select * from t_op_seae '+str+' order by ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
t_op_seae.open;
end;
procedure Tfrm_cw_pingzheng_gj.bsSkinButton3Click(Sender: TObject);
begin
Edit4.text:='';
Edit2.text:='';
wwDBDateTimePicker1.text:='';
wwDBDateTimePicker2.text:='';
wwDBDateTimePicker3.text:='';
wwDBDateTimePicker4.text:='';
end;
procedure Tfrm_cw_pingzheng_gj.bsSkinButton5Click(Sender: TObject);
begin
close;
end;
procedure Tfrm_cw_pingzheng_gj.bsSkinButton4Click(Sender: TObject);
var
str:widestring;
begin
str:='where <20><><EFBFBD><EFBFBD>״̬='+''''+'<27><><EFBFBD>÷<EFBFBD><C3B7><EFBFBD>'+'''';
// str:='where 1=1 ';
if not bsSkinCheckRadioBox2.Checked then
str:=str+' and (<28><><EFBFBD><EFBFBD> is null or <20><><EFBFBD><EFBFBD>=0)';
if Edit1.text<>'' then begin
if Edit13.text<>'' then
str:=str+' and ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>>='+''''+Edit1.text+''''+' and ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><='+''''+Edit13.text+''''
else
str:=str+' and ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD> like '+''''+'%'+Edit1.text+'%'+'''';
end;
if wwDBLookupCombo1.Text<>''then
str:=str+' and <20><><EFBFBD><EFBFBD>='+''''+wwDBLookupCombo1.Text+'''';
if Edit35.Text<>''then
str:=str+' and <20><><EFBFBD><EFBFBD>='+''''+Edit35.Text+'''';
if Edit18.text<>'' then begin
if Edit19.text<>'' then
str:=str+' and <20><><EFBFBD><EFBFBD>ƾ֤>='+''''+Edit18.text+''''+' and <20><><EFBFBD><EFBFBD>ƾ֤<='+''''+Edit19.text+''''
else
str:=str+' and <20><><EFBFBD><EFBFBD>ƾ֤ like '+''''+'%'+Edit18.text+'%'+'''';
end;
if RxDBLookupCombo8.DisplayValue<>''then
str:=str+' and <20><><EFBFBD>۲<EFBFBD><DBB2><EFBFBD>='+''''+RxDBLookupCombo8.DisplayValues[0]+'''';
if RxDBLookupCombo9.DisplayValue<>''then
str:=str+' and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>='+''''+RxDBLookupCombo9.DisplayValues[0]+'''';
if RxDBLookupCombo10.DisplayValue<>''then
str:=str+' and ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD> in (select distinct bsno from v_vouitems where prepared='+''''+RxDBLookupCombo10.DisplayValues[0]+''''+')';
if Edit3.text<>''then
str:=str+' and <20><><EFBFBD><EFBFBD><E1B5A5> like '+''''+'%'+Edit3.text+'%'+'''';
if wwDBDateTimePicker5.text<>''then
str:=str+' and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>>='+''''+wwDBDateTimePicker5.text+'''';
if wwDBDateTimePicker6.text<>''then
str:=str+' and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><='+''''+wwDBDateTimePicker6.text+'''';
if wwDBDateTimePicker7.text<>''then
str:=str+' and <20><><EFBFBD><EFBFBD><EFBFBD>ڼ<EFBFBD>>='+''''+wwDBDateTimePicker7.text+'''';
if wwDBDateTimePicker8.text<>''then
str:=str+' and <20><><EFBFBD><EFBFBD><EFBFBD>ڼ<EFBFBD><='+''''+wwDBDateTimePicker8.text+'''';
t_op_seai.close;
t_op_seai.sql.clear;
t_op_seai.sql.add('select * from t_op_seai '+str+' order by ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
t_op_seai.open;
end;
procedure Tfrm_cw_pingzheng_gj.bsSkinButton6Click(Sender: TObject);
begin
Edit1.text:='';
Edit3.text:='';
wwDBDateTimePicker5.text:='';
wwDBDateTimePicker6.text:='';
wwDBDateTimePicker7.text:='';
wwDBDateTimePicker8.text:='';
end;
procedure Tfrm_cw_pingzheng_gj.bsSkinButton7Click(Sender: TObject);
var
i,ordno:integer;
aQuery:TAdoQuery;
begin
NewBsVoucher(2,'t_op_seai','<27><><EFBFBD><EFBFBD><E1B5A5>',dxDBGrid5,t_op_seai);
{
if wwDBDateTimePicker21.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 RxDBLookupCombo6.DisplayValue='' then begin
MessageDlg('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƶ<EFBFBD><C6B5>ˣ<EFBFBD>',mterror,[mbyes],0);
exit;
end;
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_op_seai set <20><><EFBFBD><EFBFBD>=1,<2C><><EFBFBD><EFBFBD>ƾ֤=:<3A><><EFBFBD><EFBFBD>ƾ֤ where ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>=:ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
VoucherDate:=wwDBDateTimePicker21.Date;
if DBGridEh4.SelectedRows.Count>1 then begin
if not ASSIGNED(frm_sys_progress) then
frm_sys_progress:=tfrm_sys_progress.Create(self);
try
frm_sys_progress.bsSkinGauge1.ProgressText:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƾ֤<C6BE><D6A4><EFBFBD>Ժ󡣡<D4BA><F3A1A3A1><EFBFBD>';
frm_sys_progress.Show;
frm_sys_progress.bsSkinGauge1.MaxValue:=DBGridEh4.SelectedRows.Count;
frm_sys_progress.bsSkinGauge1.MinValue:=0;
frm_sys_progress.bsSkinGauge1.Value:=0;
frm_sys_progress.Update;
for i:=0 to DBGridEh4.SelectedRows.Count-1 do begin
t_op_seai.GotoBookmark(Pointer(DBGridEh4.SelectedRows.Items[I]));
if t_op_seai['<27><><EFBFBD><EFBFBD>'] then begin
MessageDlg('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:'+t_op_seai['ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']+'<27>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD><EFBFBD>ƾ֤<C6BE><D6A4><EFBFBD>޷<EFBFBD><DEB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɣ<EFBFBD>',mterror,[mbyes],0);
end else begin
NewDrCrVou(t_op_seai,2,t_op_seai['<27><><EFBFBD><EFBFBD><E1B5A5>'],wwDBDateTimePicker21.Date,'');
aQuery.Parameters.ParamByName('<27><><EFBFBD><EFBFBD>ƾ֤').Value:=dmacc.ADOTblVou.fieldbyname('ordno').AsString;
aQuery.Parameters.ParamByName('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').Value:=t_op_seai.fieldbyname('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString;
aQuery.ExecSQL;
end;
frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1;
end;
finally
freeAndNil(frm_sys_progress);
end;
end else begin
NewDrCrVou(t_op_seai,2,t_op_seai['<27><><EFBFBD><EFBFBD><E1B5A5>'],wwDBDateTimePicker21.Date,'');
aQuery.Parameters.ParamByName('<27><><EFBFBD><EFBFBD>ƾ֤').Value:=dmacc.ADOTblVou.fieldbyname('ordno').AsString;
aQuery.Parameters.ParamByName('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').Value:=t_op_seai.fieldbyname('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString;
aQuery.ExecSQL;
end;
finally
dmAcc.AdotblVouItems.Close;
dmAcc.AdotblVou.Close;
freeAndNil(dmacc);
end;
bsSkinButton4.OnClick(sender);
}
end;
procedure Tfrm_cw_pingzheng_gj.bsSkinButton8Click(Sender: TObject);
var
aQuery:TADOQuery;
Str:String;
begin
if not bsSkinCheckRadioBox6.checked then
str:=str+' and v.Status=0 ';
if wwDBDateTimePicker19.text<>''then
str:=str+' and v.voudate>='+''''+wwDBDateTimePicker19.text+'''';
if wwDBDateTimePicker20.text<>''then
str:=str+' and v.voudate<='+''''+wwDBDateTimePicker20.text+'''';
if EditOrdNoFrm.text<>''then
str:=str+' and v.ordno>='+''+EditOrdNoFrm.text+'';
if EditOrdNoTo.text<>''then
str:=str+' and v.ordno<='+''+EditOrdNoTo.text+'';
if RxDBLookupCombo5.DisplayValue<>''then
str:=str+' and v.prepared='+''''+RxDBLookupCombo5.DisplayValues[0]+'''';
{
if EditMblNo.text<>''then
str:=str+' and v.ordno>='+''+EditMblNo.text+'';
}
aQuery:=CreateAdoQuery;
try
with aQuery do begin
Close;SQL.Clear;
SQL.Add('Select 0 selected,V.* from Vouchers V where 1=1 ');
SQL.Add(str);
SQL.Add('Order by V.ORDNO');
Open;
end;
memTblVou.LoadFromDataSet(aQuery,[]);
finally
freeAndNil(aQuery);
end;
if memtblvou.IsEmpty then exit;
qryVouitems.Close;
qryVouitems.sql.Clear;
qryVouitems.SQL.Add('select * from vouitems where ordno=:ordno order by ordno,itemno');
qryVouitems.Open;
qryVouitems_sum.Close;
qryVouitems_sum.sql.Clear;
qryVouitems_sum.SQL.Add('select ordno,sum(AmtDr) AmtDr, sum(AmtCr) AmtCr, sum(FcyDr) FcyDr, sum(FcyCr) FcyCr,sum(FcyDr*FCYEXRATE) FcyDrtoRmb, sum(FcyCr*FCYEXRATE) FcyCrtoRmb');
qryVouitems_sum.SQL.Add('from vouitems');
qryVouitems_sum.SQL.Add('where ordno=:ordno');
qryVouitems_sum.SQL.Add('Group by ordno');
qryVouitems_sum.SQL.Add('order by ordno');
qryVouitems_sum.Open;
end;
procedure Tfrm_cw_pingzheng_gj.bsSkinButton9Click(Sender: TObject);
var
str:widestring;
begin
str:='where <20><><EFBFBD><EFBFBD>״̬='+''''+'<27><><EFBFBD>÷<EFBFBD><C3B7><EFBFBD>'+'''';
// str:='where 1=1 ';
if not bsSkinCheckRadioBox3.Checked then
str:=Str+' and (<28><><EFBFBD><EFBFBD> is null or <20><><EFBFBD><EFBFBD>=0)';
if Edit5.text<>'' then begin
if Edit14.text<>'' then
str:=str+' and ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>>='+''''+Edit5.text+''''+' and ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><='+''''+Edit14.text+''''
else
str:=str+' and ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD> like '+''''+'%'+Edit5.text+'%'+'''';
end;
if Edit20.text<>'' then begin
if Edit21.text<>'' then
str:=str+' and <20><><EFBFBD><EFBFBD>ƾ֤>='+''''+Edit20.text+''''+' and <20><><EFBFBD><EFBFBD>ƾ֤<='+''''+Edit21.text+''''
else
str:=str+' and <20><><EFBFBD><EFBFBD>ƾ֤ like '+''''+'%'+Edit20.text+'%'+'''';
end;
if RxDBLookupCombo11.DisplayValue<>''then
str:=str+' and <20><><EFBFBD>۲<EFBFBD><DBB2><EFBFBD>='+''''+RxDBLookupCombo11.DisplayValues[0]+'''';
if RxDBLookupCombo12.DisplayValue<>''then
str:=str+' and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>='+''''+RxDBLookupCombo12.DisplayValues[0]+'''';
if RxDBLookupCombo13.DisplayValue<>''then
str:=str+' and ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD> in (select distinct bsno from v_vouitems where prepared='+''''+RxDBLookupCombo13.DisplayValues[0]+''''+')';
if Edit6.text<>''then
str:=str+' and <20><><EFBFBD>˵<EFBFBD><CBB5><EFBFBD> like '+''''+'%'+Edit6.text+'%'+'''';
if wwDBDateTimePicker9.text<>''then
str:=str+' and һ<>̿<EFBFBD><CCBF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>>='+''''+wwDBDateTimePicker9.text+'''';
if wwDBDateTimePicker10.text<>''then
str:=str+' and һ<>̿<EFBFBD><CCBF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><='+''''+wwDBDateTimePicker10.text+'''';
if wwDBDateTimePicker11.text<>''then
str:=str+' and <20><><EFBFBD><EFBFBD><EFBFBD>ڼ<EFBFBD>>='+''''+wwDBDateTimePicker11.text+'''';
if wwDBDateTimePicker12.text<>''then
str:=str+' and <20><><EFBFBD><EFBFBD><EFBFBD>ڼ<EFBFBD><='+''''+wwDBDateTimePicker12.text+'''';
if wwDBDateTimePicker30.text<>''then
str:=str+' and <20><><EFBFBD>÷<EFBFBD><C3B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>>='+''''+wwDBDateTimePicker30.text+'''';
if wwDBDateTimePicker31.text<>''then
str:=str+' and <20><><EFBFBD>÷<EFBFBD><C3B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><='+''''+wwDBDateTimePicker31.text+'''';
if Edit42.text<>'' then
str:=str+' and ί<>б<EFBFBD><D0B1><EFBFBD> like '+''''+'%'+Edit42.text+'%'+'''';
t_op_aire.close;
t_op_aire.sql.clear;
t_op_aire.sql.add('select * from t_op_aire '+str+' order by ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
t_op_aire.open;
end;
procedure Tfrm_cw_pingzheng_gj.bsSkinButton11Click(Sender: TObject);
begin
Edit5.text:='';
Edit6.text:='';
wwDBDateTimePicker9.text:='';
wwDBDateTimePicker10.text:='';
wwDBDateTimePicker11.text:='';
wwDBDateTimePicker12.text:='';
end;
procedure Tfrm_cw_pingzheng_gj.bsSkinButton14Click(Sender: TObject);
var
str:widestring;
begin
str:='where <20><><EFBFBD><EFBFBD>״̬='+''''+'<27><><EFBFBD>÷<EFBFBD><C3B7><EFBFBD>'+'''';
// str:='where 1=1 ';
if not bsSkinCheckRadioBox4.Checked then
str:=Str+' and (<28><><EFBFBD><EFBFBD> is null or <20><><EFBFBD><EFBFBD>=0)';
if Edit7.text<>'' then begin
if Edit15.text<>'' then
str:=str+' and ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>>='+''''+Edit7.text+''''+' and ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><='+''''+Edit15.text+''''
else
str:=str+' and ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD> like '+''''+'%'+Edit7.text+'%'+'''';
end;
if Edit22.text<>'' then begin
if Edit23.text<>'' then
str:=str+' and <20><><EFBFBD><EFBFBD>ƾ֤>='+''''+Edit22.text+''''+' and <20><><EFBFBD><EFBFBD>ƾ֤<='+''''+Edit23.text+''''
else
str:=str+' and <20><><EFBFBD><EFBFBD>ƾ֤ like '+''''+'%'+Edit22.text+'%'+'''';
end;
if RxDBLookupCombo14.DisplayValue<>''then
str:=str+' and <20><><EFBFBD>۲<EFBFBD><DBB2><EFBFBD>='+''''+RxDBLookupCombo14.DisplayValues[0]+'''';
if RxDBLookupCombo15.DisplayValue<>''then
str:=str+' and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>='+''''+RxDBLookupCombo15.DisplayValues[0]+'''';
if RxDBLookupCombo16.DisplayValue<>''then
str:=str+' and ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD> in (select distinct bsno from v_vouitems where prepared='+''''+RxDBLookupCombo16.DisplayValues[0]+''''+')';
if Edit8.text<>''then
str:=str+' and <20><><EFBFBD>˵<EFBFBD><CBB5><EFBFBD> like '+''''+'%'+Edit8.text+'%'+'''';
if wwDBDateTimePicker13.text<>''then
str:=str+' and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>>='+''''+wwDBDateTimePicker13.text+'''';
if wwDBDateTimePicker14.text<>''then
str:=str+' and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><='+''''+wwDBDateTimePicker14.text+'''';
if wwDBDateTimePicker15.text<>''then
str:=str+' and <20><><EFBFBD><EFBFBD><EFBFBD>ڼ<EFBFBD>>='+''''+wwDBDateTimePicker15.text+'''';
if wwDBDateTimePicker16.text<>''then
str:=str+' and <20><><EFBFBD><EFBFBD><EFBFBD>ڼ<EFBFBD><='+''''+wwDBDateTimePicker16.text+'''';
t_op_airi.close;
t_op_airi.sql.clear;
t_op_airi.sql.add('select * from t_op_airi '+str+' order by ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
t_op_airi.open;
end;
procedure Tfrm_cw_pingzheng_gj.bsSkinButton15Click(Sender: TObject);
begin
Edit7.text:='';
Edit8.text:='';
wwDBDateTimePicker13.text:='';
wwDBDateTimePicker14.text:='';
wwDBDateTimePicker15.text:='';
wwDBDateTimePicker16.text:='';
end;
procedure Tfrm_cw_pingzheng_gj.NewBsVoucher(bstype:integer;TableName,BsField:string;Dbgrid1:TDxDBGrid;aDataset:TADOQuery);
var
i,ordno:integer;
aQuery:TAdoQuery;
Explan:string;
bsList,s:string;
begin
if wwDBDateTimePicker21.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 RxDBLookupCombo6.DisplayValue='' then begin
MessageDlg('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƶ<EFBFBD><C6B5>ˣ<EFBFBD>',mterror,[mbyes],0);
exit;
end;
s:='';
s:=checkbsVoucher(Dbgrid1,aDataset);
if s<>'' then
begin
ShowMessage('<27><>ʤ<EFBFBD><CAA4><EFBFBD><EFBFBD>:'+s);
exit;
end;
dmacc:=TdmAcc.Create(self);
aQuery:=CreateAdoQuery;
try
dmAcc.ADOtblVou.Open;
dmAcc.ADOtblVouItems.Open;
aVKNO:=1;
VoucherDate:=wwDBDateTimePicker21.Date;
if Dbgrid1.SelectedCount>1 then begin
if not ASSIGNED(frm_sys_progress) then
frm_sys_progress:=tfrm_sys_progress.Create(self);
try
frm_sys_progress.bsSkinGauge1.ProgressText:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƾ֤<C6BE><D6A4><EFBFBD>Ժ󡣡<D4BA><F3A1A3A1><EFBFBD>';
frm_sys_progress.Show;
frm_sys_progress.bsSkinGauge1.MaxValue:=Dbgrid1.SelectedCount;
frm_sys_progress.bsSkinGauge1.MinValue:=0;
frm_sys_progress.bsSkinGauge1.Value:=0;
frm_sys_progress.Update;
bsList:='';
for i:=0 to Dbgrid1.SelectedCount-1 do
begin
aDataset.GotoBookmark(Pointer(Dbgrid1.selectedrows[I]));;
if aDataset['<27><><EFBFBD><EFBFBD>'] then
begin
MessageDlg('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:'+aDataset['ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']+'<27>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD><EFBFBD>ƾ֤<C6BE><D6A4><EFBFBD>޷<EFBFBD><DEB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɣ<EFBFBD>',mterror,[mbyes],0);
end
else
begin
bsList:=''''+aDataset.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString+'''';
NewDrCrVou(aDataset,bstype,aDataset.FieldByName(BsField).AsString,wwDBDateTimePicker21.Date,bsList);
aQuery.Close;
aQuery.SQL.Clear;
aQuery.SQL.add('update '+ TableName+' set <20><><EFBFBD><EFBFBD>=1,<2C><><EFBFBD><EFBFBD>ƾ֤=:<3A><><EFBFBD><EFBFBD>ƾ֤ where <20><><EFBFBD><EFBFBD> in ('+bsList+')');
aQuery.Parameters.ParamByName('<27><><EFBFBD><EFBFBD>ƾ֤').Value:=dmacc.ADOTblVou.fieldbyname('ordno').AsString;
aQuery.ExecSQL;
end;
end ;
frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1;
finally
freeAndNil(frm_sys_progress);
end;
end
else
begin
if aDataset['<27><><EFBFBD><EFBFBD>'] then
begin
MessageDlg('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:'+aDataset['ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']+'<27>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD><EFBFBD>ƾ֤<C6BE><D6A4><EFBFBD>޷<EFBFBD><DEB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɣ<EFBFBD>',mterror,[mbyes],0);
end
else
begin
bsList:=''''+aDataset.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString+'''';
NewDrCrVou(aDataset,bstype,aDataset.FieldByName(BsField).AsString,wwDBDateTimePicker21.Date,bsList);
aQuery.Close;
aQuery.SQL.Clear;
aQuery.SQL.add('update '+ TableName+' set <20><><EFBFBD><EFBFBD>=1,<2C><><EFBFBD><EFBFBD>ƾ֤=:<3A><><EFBFBD><EFBFBD>ƾ֤ where <20><><EFBFBD><EFBFBD> in ('+bsList+')');
aQuery.Parameters.ParamByName('<27><><EFBFBD><EFBFBD>ƾ֤').Value:=dmacc.ADOTblVou.fieldbyname('ordno').AsString;
aQuery.ExecSQL;
end;
end;
finally
dmAcc.AdotblVouItems.Close;
dmAcc.AdotblVou.Close;
freeAndNil(dmacc);
aDataset.Requery();
end;
// bsSkinButton10.OnClick(sender);
end;
{procedure Tfrm_cw_pingzheng.NewBsVoucher(bstype:integer;TableName,BsField:string;Dbgrid1:TDBGridEh;aDataset:TADOQuery);
var
i,ordno:integer;
aQuery:TAdoQuery;
Explan:string;
bsList:string;
begin
if wwDBDateTimePicker21.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 RxDBLookupCombo6.DisplayValue='' then begin
MessageDlg('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƶ<EFBFBD><C6B5>ˣ<EFBFBD>',mterror,[mbyes],0);
exit;
end;
dmacc:=TdmAcc.Create(self);
aQuery:=CreateAdoQuery;
try
dmAcc.ADOtblVou.Open;
dmAcc.ADOtblVouItems.Open;
aVKNO:=1;
VoucherDate:=wwDBDateTimePicker21.Date;
if Dbgrid1.SelectedRows.Count>1 then begin
if not ASSIGNED(frm_sys_progress) then
frm_sys_progress:=tfrm_sys_progress.Create(self);
try
frm_sys_progress.bsSkinGauge1.ProgressText:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƾ֤<C6BE><D6A4><EFBFBD>Ժ󡣡<D4BA><F3A1A3A1><EFBFBD>';
frm_sys_progress.Show;
frm_sys_progress.bsSkinGauge1.MaxValue:=Dbgrid1.SelectedRows.Count;
frm_sys_progress.bsSkinGauge1.MinValue:=0;
frm_sys_progress.bsSkinGauge1.Value:=0;
frm_sys_progress.Update;
bsList:='';
for i:=0 to Dbgrid1.SelectedRows.Count-1 do
begin
aDataset.GotoBookmark(Pointer(Dbgrid1.SelectedRows.Items[I]));
if not t_cw_design.fieldbyname('<27><><EFBFBD>ݴ<EFBFBD><DDB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƾ֤').asboolean then
begin
if aDataset['<27><><EFBFBD><EFBFBD>'] then
begin
MessageDlg('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:'+aDataset['ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']+'<27>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD><EFBFBD>ƾ֤<C6BE><D6A4><EFBFBD>޷<EFBFBD><DEB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɣ<EFBFBD>',mterror,[mbyes],0);
end
else
begin
bsList:=''''+aDataset.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString+'''';
NewDrCrVou(aDataset,bstype,aDataset[BsField],wwDBDateTimePicker21.Date,bsList);
aQuery.Close;
aQuery.SQL.Clear;
aQuery.SQL.add('update '+ TableName+' set <20><><EFBFBD><EFBFBD>=1,<2C><><EFBFBD><EFBFBD>ƾ֤=:<3A><><EFBFBD><EFBFBD>ƾ֤ where <20><><EFBFBD><EFBFBD> in ('+bsList+')');
aQuery.Parameters.ParamByName('<27><><EFBFBD><EFBFBD>ƾ֤').Value:=dmacc.ADOTblVou.fieldbyname('ordno').AsString;
aQuery.ExecSQL;
end;
end
else
begin //
if aDataset['<27><><EFBFBD><EFBFBD>'] then
begin
MessageDlg('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:'+aDataset['ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']+'<27>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD><EFBFBD>ƾ֤<C6BE><D6A4><EFBFBD>޷<EFBFBD><DEB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɣ<EFBFBD>',mterror,[mbyes],0);
end
else
begin
if bsList='' then
bsList:=''''+aDataset.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString+''''
else bsList:=bsList+','+''''+aDataset.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString+'''';
end;
end;
frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1;
end;
if t_cw_design.fieldbyname('<27><><EFBFBD>ݴ<EFBFBD><DDB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƾ֤').asboolean then
begin
NewDrCrVou(aDataset,bstype,aDataset[BsField],wwDBDateTimePicker21.Date,bsList);
aQuery.Close;
aQuery.SQL.Clear;
aQuery.SQL.add('update '+ TableName+' set <20><><EFBFBD><EFBFBD>=1,<2C><><EFBFBD><EFBFBD>ƾ֤=:<3A><><EFBFBD><EFBFBD>ƾ֤ where <20><><EFBFBD><EFBFBD> in ('+bsList+')');
aQuery.Parameters.ParamByName('<27><><EFBFBD><EFBFBD>ƾ֤').Value:=dmacc.ADOTblVou.fieldbyname('ordno').AsString;
aQuery.ExecSQL;
end;
finally
freeAndNil(frm_sys_progress);
end;
end
else
begin
if aDataset['<27><><EFBFBD><EFBFBD>'] then
begin
MessageDlg('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:'+aDataset['ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']+'<27>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD><EFBFBD>ƾ֤<C6BE><D6A4><EFBFBD>޷<EFBFBD><DEB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɣ<EFBFBD>',mterror,[mbyes],0);
end
else
begin
bsList:=''''+aDataset.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString+'''';
NewDrCrVou(aDataset,bstype,aDataset[BsField],wwDBDateTimePicker21.Date,bsList);
aQuery.Close;
aQuery.SQL.Clear;
aQuery.SQL.add('update '+ TableName+' set <20><><EFBFBD><EFBFBD>=1,<2C><><EFBFBD><EFBFBD>ƾ֤=:<3A><><EFBFBD><EFBFBD>ƾ֤ where <20><><EFBFBD><EFBFBD> in ('+bsList+')');
aQuery.Parameters.ParamByName('<27><><EFBFBD><EFBFBD>ƾ֤').Value:=dmacc.ADOTblVou.fieldbyname('ordno').AsString;
aQuery.ExecSQL;
end;
end;
finally
dmAcc.AdotblVouItems.Close;
dmAcc.AdotblVou.Close;
freeAndNil(dmacc);
aDataset.Requery();
end;
// bsSkinButton10.OnClick(sender);
end;
}
procedure Tfrm_cw_pingzheng_gj.bsSkinButton1Click(Sender: TObject);
var
i,ordno:integer;
aQuery:TAdoQuery;
Explan:string;
bsList:string;
begin
NewBsVoucher(1,'t_op_seae','<27><><EFBFBD><EFBFBD><E1B5A5>',dxDBGrid4,t_op_seae);
{
if wwDBDateTimePicker21.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 RxDBLookupCombo6.DisplayValue='' then begin
MessageDlg('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƶ<EFBFBD><C6B5>ˣ<EFBFBD>',mterror,[mbyes],0);
exit;
end;
dmacc:=TdmAcc.Create(self);
aQuery:=CreateAdoQuery;
try
dmAcc.ADOtblVou.Open;
dmAcc.ADOtblVouItems.Open;
aVKNO:=1;
VoucherDate:=wwDBDateTimePicker21.Date;
if DBGridEh1.SelectedRows.Count>1 then begin
if not ASSIGNED(frm_sys_progress) then
frm_sys_progress:=tfrm_sys_progress.Create(self);
try
frm_sys_progress.bsSkinGauge1.ProgressText:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƾ֤<C6BE><D6A4><EFBFBD>Ժ󡣡<D4BA><F3A1A3A1><EFBFBD>';
frm_sys_progress.Show;
frm_sys_progress.bsSkinGauge1.MaxValue:=DBGridEh1.SelectedRows.Count;
frm_sys_progress.bsSkinGauge1.MinValue:=0;
frm_sys_progress.bsSkinGauge1.Value:=0;
frm_sys_progress.Update;
bsList:='';
for i:=0 to DBGridEh1.SelectedRows.Count-1 do
begin
t_op_seae.GotoBookmark(Pointer(DBGridEh1.SelectedRows.Items[I]));
if not t_cw_design.fieldbyname('<27><><EFBFBD>ݴ<EFBFBD><DDB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƾ֤').asboolean then
begin
if t_op_seae['<27><><EFBFBD><EFBFBD>'] then
begin
MessageDlg('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:'+t_op_seae['ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']+'<27>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD><EFBFBD>ƾ֤<C6BE><D6A4><EFBFBD>޷<EFBFBD><DEB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɣ<EFBFBD>',mterror,[mbyes],0);
end
else
begin
bsList:=''''+t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString+'''';
NewDrCrVou(t_op_seae,1,t_op_seae['<27><><EFBFBD><EFBFBD><E1B5A5>'],wwDBDateTimePicker21.Date,bsList);
aQuery.Close;
aQuery.SQL.Clear;
aQuery.SQL.add('update t_op_seae set <20><><EFBFBD><EFBFBD>=1,<2C><><EFBFBD><EFBFBD>ƾ֤=:<3A><><EFBFBD><EFBFBD>ƾ֤ where <20><><EFBFBD><EFBFBD> in ('+bsList+')');
aQuery.Parameters.ParamByName('<27><><EFBFBD><EFBFBD>ƾ֤').Value:=dmacc.ADOTblVou.fieldbyname('ordno').AsString;
aQuery.ExecSQL;
end;
end
else
begin //
if t_op_seae['<27><><EFBFBD><EFBFBD>'] then
begin
MessageDlg('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:'+t_op_seae['ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']+'<27>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD><EFBFBD>ƾ֤<C6BE><D6A4><EFBFBD>޷<EFBFBD><DEB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɣ<EFBFBD>',mterror,[mbyes],0);
end
else
begin
if bsList='' then
bsList:=''''+t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString+''''
else bsList:=bsList+','+''''+t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString+'''';
end;
end;
frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1;
end;
if t_cw_design.fieldbyname('<27><><EFBFBD>ݴ<EFBFBD><DDB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƾ֤').asboolean then
begin
NewDrCrVou(t_op_seae,1,t_op_seae['<27><><EFBFBD><EFBFBD><E1B5A5>'],wwDBDateTimePicker21.Date,bsList);
aQuery.Close;
aQuery.SQL.Clear;
aQuery.SQL.add('update t_op_seae set <20><><EFBFBD><EFBFBD>=1,<2C><><EFBFBD><EFBFBD>ƾ֤=:<3A><><EFBFBD><EFBFBD>ƾ֤ where <20><><EFBFBD><EFBFBD> in ('+bsList+')');
aQuery.Parameters.ParamByName('<27><><EFBFBD><EFBFBD>ƾ֤').Value:=dmacc.ADOTblVou.fieldbyname('ordno').AsString;
aQuery.ExecSQL;
end;
finally
freeAndNil(frm_sys_progress);
end;
end
else
begin
if t_op_seae['<27><><EFBFBD><EFBFBD>'] then
begin
MessageDlg('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:'+t_op_seae['ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']+'<27>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD><EFBFBD>ƾ֤<C6BE><D6A4><EFBFBD>޷<EFBFBD><DEB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɣ<EFBFBD>',mterror,[mbyes],0);
end
else
begin
bsList:=''''+t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString+'''';
NewDrCrVou(t_op_seae,1,t_op_seae['<27><><EFBFBD><EFBFBD><E1B5A5>'],wwDBDateTimePicker21.Date,bsList);
aQuery.Close;
aQuery.SQL.Clear;
aQuery.SQL.add('update t_op_seae set <20><><EFBFBD><EFBFBD>=1,<2C><><EFBFBD><EFBFBD>ƾ֤=:<3A><><EFBFBD><EFBFBD>ƾ֤ where <20><><EFBFBD><EFBFBD> in ('+bsList+')');
aQuery.Parameters.ParamByName('<27><><EFBFBD><EFBFBD>ƾ֤').Value:=dmacc.ADOTblVou.fieldbyname('ordno').AsString;
aQuery.ExecSQL;
end;
end;
finally
dmAcc.AdotblVouItems.Close;
dmAcc.AdotblVou.Close;
freeAndNil(dmacc);
end;
bsSkinButton10.OnClick(sender);
}
end;
procedure Tfrm_cw_pingzheng_gj.bsSkinButton18Click(Sender: TObject);
var
Str:String;
begin
str:='where 1=1 and <20>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD><>''''';
if not bsSkinCheckRadioBox5.Checked then
str:=str+' and (<28><><EFBFBD><EFBFBD> is null or <20><><EFBFBD><EFBFBD>=0)'
else str:=str+' and (<28><><EFBFBD><EFBFBD> is null or <20><><EFBFBD><EFBFBD>=0 or <20><><EFBFBD><EFBFBD>=1)';
if Edit9.text<>''then
str:=str+' and <20>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD> like '+''''+'%'+Edit9.text+'%'+'''';
if Edit12.text<>''then
str:=str+' and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>='+Trim(Edit12.text);
if RxDBLookupCombo2.DisplayValue<>''then
str:=str+' and <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD> ='+''''+RxDBLookupCombo2.DisplayValues[1]+'''';
if RxDBLookupCombo7.DisplayValue<>''then
str:=str+' and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ='+''''+RxDBLookupCombo7.DisplayValues[0]+'''';
if wwDBDateTimePicker17.text<>''then
str:=str+' and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>>='+''''+wwDBDateTimePicker17.text+'''';
if wwDBDateTimePicker18.text<>''then
str:=str+' and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><='+''''+wwDBDateTimePicker18.text+'''';
if wwDBComboBox1.Text<>'' then begin
if wwDBComboBox1.ItemIndex=0 then
str:=str+' and <20><><EFBFBD><EFBFBD>=''<27><>'''
else
str:=str+' and <20><><EFBFBD><EFBFBD>=''<27><>''';
end;
t_op_balance.close;
t_op_balance.sql.clear;
t_op_balance.sql.add('select * from t_ch_balance '+str+' order by <20>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>');
t_op_balance.open;
t_op_balance_items.Close;
t_op_balance_items.Open;
end;
procedure Tfrm_cw_pingzheng_gj.NewDCVou_one;
var
i,ordno:integer;
aQuery:TAdoQuery;
aModal:TModalResult;
mAccOK:boolean;
begin
if wwDBDateTimePicker21.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 RxDBLookupCombo6.DisplayValue='' then begin
MessageDlg('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƶ<EFBFBD><C6B5>ˣ<EFBFBD>',mterror,[mbyes],0);
exit;
end;
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_balance set <20><><EFBFBD><EFBFBD>=1,<2C><><EFBFBD><EFBFBD>ƾ֤=:<3A><><EFBFBD><EFBFBD>ƾ֤ where <20>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>=:<3A>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>');
VoucherDate:=wwDBDateTimePicker21.Date;
// try
dmAcc.AdotblVou.Insert;
dmAcc.AdotblVou.FieldByName('SourceType').AsInteger:=2;
dmAcc.AdotblVou.FieldByName('ATTACHS').AsInteger:=AccInfo.ATTACHS;
if Trim(t_op_balance.FieldByName('<27><><EFBFBD><EFBFBD>').AsString)='<27><>' then
begin
if Trim(t_cw_design.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD>տ<EFBFBD>ƾ֤<C6BE><D6A4>').AsString)<>'' then
begin
dmAcc.AdotblVou.FieldByName('VKNO').AsString:=Trim(t_cw_design.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD>տ<EFBFBD>ƾ֤<C6BE><D6A4>').AsString);
end
else dmAcc.AdotblVou.FieldByName('VKNO').AsString:='<27><>';
end
else
begin
if Trim(t_cw_design.FieldByName('<27><><EFBFBD>и<EFBFBD><D0B8><EFBFBD>ƾ֤<C6BE><D6A4>').AsString)<>'' then
begin
dmAcc.AdotblVou.FieldByName('VKNO').AsString:=Trim(t_cw_design.FieldByName('<27><><EFBFBD>и<EFBFBD><D0B8><EFBFBD>ƾ֤<C6BE><D6A4>').AsString);
end
else dmAcc.AdotblVou.FieldByName('VKNO').AsString:='<27><>';
end;
{
if Trim(AccInfo.TransName)<>'' then
dmAcc.AdotblVou.FieldByName('VKNO').AsString:=AccInfo.TransName
else dmAcc.AdotblVou.FieldByName('VKNO').AsString:='<27><>';
}
dmAcc.AdotblVou.FieldByName('PREPARED').AsString:=RxDBLookupCombo6.DisplayValues[0];
dmAcc.AdotblVou.Post;
dmAcc.AdotblVou.Edit;
// cxGrid1DBTableView1.Controller..SelectedRowCount
if dxDBGrid2.SelectedCount>1 then begin
if not ASSIGNED(frm_sys_progress) then
frm_sys_progress:=tfrm_sys_progress.Create(self);
// try
frm_sys_progress.bsSkinGauge1.ProgressText:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƾ֤<C6BE><D6A4><EFBFBD>Ժ󡣡<D4BA><F3A1A3A1><EFBFBD>';
frm_sys_progress.Show;
frm_sys_progress.bsSkinGauge1.MaxValue:=dxDBGrid2.SelectedCount;
frm_sys_progress.bsSkinGauge1.MinValue:=0;
frm_sys_progress.bsSkinGauge1.Value:=0;
frm_sys_progress.Update;
for i:=0 to dxDBGrid2.SelectedCount-1 do begin
t_op_balance.GotoBookmark(Pointer(dxDBGrid2.selectedrows[I]));
if t_op_balance['<27><><EFBFBD><EFBFBD>'] then begin
MessageDlg('<27>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>:'+t_op_balance.fieldbyname('<27>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>').AsString+'<27>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD><EFBFBD>ƾ֤<C6BE><D6A4><EFBFBD>޷<EFBFBD><DEB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɣ<EFBFBD>',mterror,[mbyes],0);
end else begin
NewDCVou_Patch(t_op_balance,RxDBLookupCombo6.DisplayValues[0],wwDBDateTimePicker21.Date);
aQuery.Parameters.ParamByName('<27><><EFBFBD><EFBFBD>ƾ֤').Value:=dmacc.ADOTblVou.fieldbyname('ordno').AsString;
aQuery.Parameters.ParamByName('<27>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>').Value:=t_op_balance.fieldbyname('<27>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>').AsString;
aQuery.ExecSQL;
end;
frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1;
end;
// finally
freeAndNil(frm_sys_progress);
// end;
end else begin
NewDCVou_Patch(t_op_balance,RxDBLookupCombo6.DisplayValues[0],wwDBDateTimePicker21.Date);
aQuery.Parameters.ParamByName('<27><><EFBFBD><EFBFBD>ƾ֤').Value:=dmacc.ADOTblVou.fieldbyname('ordno').AsString;
aQuery.Parameters.ParamByName('<27>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>').Value:=t_op_balance.fieldbyname('<27>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>').AsString;
aQuery.ExecSQL;
end;
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_balance set <20><><EFBFBD><EFBFBD>=0,<2C><><EFBFBD><EFBFBD>ƾ֤='''' where <20><><EFBFBD><EFBFBD>ƾ֤='''+inttostr(OrdNo)+'''');
// dmAcc.TempQuery.Parameters.ParamByName('mOrdNo').value:=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;
bsSkinButton18.OnClick(bsSkinButton18);
end;
procedure Tfrm_cw_pingzheng_gj.NewDCVou_select;
var
i,ordno:integer;
aQuery:TAdoQuery;
aModal:TModalResult;
mAccOK:boolean;
begin
if wwDBDateTimePicker21.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 RxDBLookupCombo6.DisplayValue='' then begin
MessageDlg('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƶ<EFBFBD><C6B5>ˣ<EFBFBD>',mterror,[mbyes],0);
exit;
end;
dmacc:=TdmAcc.Create(self);
aQuery:=CreateAdoQuery;
dmAcc.ADOtblVou.Open;
dmAcc.ADOtblVouItems.Open;
aVKNO:=1;
aQuery.Close;
aQuery.SQL.Clear;
aQuery.SQL.add('update t_ch_balance set <20><><EFBFBD><EFBFBD>=1,<2C><><EFBFBD><EFBFBD>ƾ֤=:<3A><><EFBFBD><EFBFBD>ƾ֤ where <20>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>=:<3A>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>');
VoucherDate:=wwDBDateTimePicker21.Date;
if dxDBGrid2.SelectedCount>1 then
begin
if not ASSIGNED(frm_sys_progress) then
frm_sys_progress:=tfrm_sys_progress.Create(self);
frm_sys_progress.bsSkinGauge1.ProgressText:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƾ֤<C6BE><D6A4><EFBFBD>Ժ󡣡<D4BA><F3A1A3A1><EFBFBD>';
frm_sys_progress.Show;
frm_sys_progress.bsSkinGauge1.MaxValue:=dxDBGrid2.SelectedCount;
frm_sys_progress.bsSkinGauge1.MinValue:=0;
frm_sys_progress.bsSkinGauge1.Value:=0;
frm_sys_progress.Update;
for i:=0 to dxDBGrid2.SelectedCount-1 do
begin
t_op_balance.GotoBookmark(Pointer(dxDBGrid2.selectedrows[I]));
if t_op_balance['<27><><EFBFBD><EFBFBD>'] then
begin
MessageDlg('<27>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>:'+t_op_balance.fieldbyname('<27>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>').AsString+'<27>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD><EFBFBD>ƾ֤<C6BE><D6A4><EFBFBD>޷<EFBFBD><DEB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɣ<EFBFBD>',mterror,[mbyes],0);
end
else
begin
if t_cw_design.fieldbyname('<27><><EFBFBD><EFBFBD>ƾ֤<C6BE><D6A4>ֵ˰<D6B5><CBB0>¼').asboolean then
NewDCVouvat(t_op_balance,RxDBLookupCombo6.DisplayValues[0],wwDBDateTimePicker21.Date)
else NewDCVou(t_op_balance,RxDBLookupCombo6.DisplayValues[0],wwDBDateTimePicker21.Date);
aQuery.Parameters.ParamByName('<27><><EFBFBD><EFBFBD>ƾ֤').Value:=dmacc.ADOTblVou.fieldbyname('ordno').AsString;
aQuery.Parameters.ParamByName('<27>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>').Value:=t_op_balance.fieldbyname('<27>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>').AsString;
aQuery.ExecSQL;
end;
frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1;
end;
end
else
begin
if t_cw_design.fieldbyname('<27><><EFBFBD><EFBFBD>ƾ֤<C6BE><D6A4>ֵ˰<D6B5><CBB0>¼').asboolean then
NewDCVouvat(t_op_balance,RxDBLookupCombo6.DisplayValues[0],wwDBDateTimePicker21.Date)
else NewDCVou(t_op_balance,RxDBLookupCombo6.DisplayValues[0],wwDBDateTimePicker21.Date);
aQuery.Parameters.ParamByName('<27><><EFBFBD><EFBFBD>ƾ֤').Value:=dmacc.ADOTblVou.fieldbyname('ordno').AsString;
aQuery.Parameters.ParamByName('<27>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>').Value:=t_op_balance.fieldbyname('<27>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>').AsString;
aQuery.ExecSQL;
end;
ordno:=dmAcc.AdotblVou.fieldbyname('ordno').asinteger;
dmAcc.AdotblVouItems.Close;
dmAcc.AdotblVou.Close;
freeAndNil(dmacc);
freeAndNil(frm_sys_progress);
bsSkinButton18.OnClick(bsSkinButton18);
end;
procedure Tfrm_cw_pingzheng_gj.bsSkinButton20Click(Sender: TObject);
var aQuery:TADOQuery;
i:Integer;
s:string;
begin
if t_op_balance.IsEmpty then
exit;
if dxDBGrid2.SelectedCount<1 then
begin
exit;
end;
aQuery:=CreateAdoQuery;
with aQuery,SQL do
begin
Close;Clear;
Add('Select s.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,s.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>,s.<2E>ո<EFBFBD>,s.<2E>ұ<EFBFBD>,s.<2E><><EFBFBD><EFBFBD>,s.<2E>Ƿ<EFBFBD><C7B7>渶,S.<2E><><EFBFBD><EFBFBD>,s.<2E><><EFBFBD><EFBFBD>');
Add(',sum(S.<2E><><EFBFBD><EFBFBD>) <20><><EFBFBD><EFBFBD>,sum(S.<2E><><EFBFBD><EFBFBD>*s.<2E><><EFBFBD><EFBFBD>) <20>ϼƽ<CFBC><C6BD><EFBFBD>');
Add('from v_fee_balance_items s');
Add('where S.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>=:<3A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
Add('Group By s.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,s.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>,s.<2E>ո<EFBFBD>,s.<2E>ұ<EFBFBD> ,s.<2E><><EFBFBD><EFBFBD>,s.<2E>Ƿ<EFBFBD><C7B7>渶,S.<2E><><EFBFBD><EFBFBD>,s.<2E><><EFBFBD><EFBFBD>');
Add('Order By s.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,s.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>,s.<2E>ո<EFBFBD>,s.<2E>ұ<EFBFBD> ,s.<2E><><EFBFBD><EFBFBD>,s.<2E>Ƿ<EFBFBD><C7B7>渶,S.<2E><><EFBFBD><EFBFBD>,s.<2E><><EFBFBD><EFBFBD>');
end;
s:='';
if dxDBGrid2.SelectedCount>1 then
begin
for i:=0 to dxDBGrid2.SelectedCount-1 do
begin
t_op_balance.GotoBookmark(Pointer(dxDBGrid2.selectedrows[I]));
if t_op_balance['<27><><EFBFBD><EFBFBD>'] then begin
MessageDlg('<27>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>:'+t_op_balance.fieldbyname('<27>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>').AsString+'<27>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD><EFBFBD>ƾ֤<C6BE><D6A4><EFBFBD>޷<EFBFBD><DEB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɣ<EFBFBD>',mterror,[mbyes],0);
end
else
begin
aQuery.Close;
aQuery.Parameters.ParamByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').Value:=t_op_balance.fieldbyname('<27>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>').AsString;
aQuery.Open;
if aQuery.IsEmpty then
begin
showmessage('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϸΪ<CFB8><CEAA>');
Exit;
end;
s:=GetNoCorpNo(t_op_balance.fieldbyname('<27>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>').AsString);
if s<>'' then
begin
showmessage(s+#13#10+'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
Exit;
end;
end;
end;
end
else
begin
aQuery.Close;
aQuery.Parameters.ParamByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').Value:=t_op_balance.fieldbyname('<27>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>').AsString;
aQuery.Open;
if aQuery.IsEmpty then
begin
showmessage('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϸΪ<CFB8><CEAA>');
Exit;
end;
s:=GetNoCorpNo(t_op_balance.fieldbyname('<27>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>').AsString);
if s<>'' then
begin
showmessage(s+#13#10+'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
Exit;
end;
end;
if t_cw_design.fieldbyname('<27>ϲ<EFBFBD><CFB2><EFBFBD><EFBFBD>ɽ<EFBFBD><C9BD><EFBFBD>ƾ֤').asboolean then
NewDCVou_One
else NewDCVou_select;
end;
procedure Tfrm_cw_pingzheng_gj.U8;
var
aQuery:TADOQuery;
Str,S,source,dbffile,exepath,adbftable:String;
connectstr:wideString;
selcount,itemno:integer;
sl:TStrings;
function GetSelCount:integer;
begin
result:=0;
memtblvou.First;
while not memtblvou.Eof do begin
result:=result+1;
memtblvou.Next;
end;
end;
begin
{
if not selectDirectory('ѡ<>񵼳<EFBFBD><F1B5BCB3>ļ<EFBFBD>Ŀ¼','',source) then begin
messagedlg( '<27><><EFBFBD><EFBFBD>ѡ<EFBFBD>񵼳<EFBFBD>·<EFBFBD><C2B7><EFBFBD><EFBFBD><EFBFBD>ܵ<EFBFBD><DCB5><EFBFBD>ƾ֤<C6BE>ļ<EFBFBD>',mterro,mbyes,0);
exit;
end;
}
if not memtblVou.Active then exit;
selcount:=GetSelCount;
if selcount=0 then begin
messagedlg( 'û<><C3BB>ѡ<EFBFBD><D1A1>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƾ֤<C6BE><D6A4><EFBFBD><EFBFBD><EFBFBD>ܵ<EFBFBD><DCB5><EFBFBD>',mtError,[mbyes],0);
exit;
end;
aQuery:=CreateADOQuery;
aQuery.SQL.Add('Update Vouchers set Status=1 where ordno=:OrdNo');
sl:=TStringList.Create;
sl.Add('<27><><EFBFBD><EFBFBD>ƾ֤,V800');
memtblVou.First;
try
while not memtblVou.Eof do begin
if memtblVou.FieldByName('Selected').AsInteger=1 then begin
qryVouitems.First;
while not qryVouitems.Eof do begin
S:='';
S:=S+FormatDateTime('YYYY-MM-DD',memTblVou.FieldByName('VouDate').AsDateTime)+','; //1
S:=S+trim(memTblVou.fieldByName('VKNO').AsString)+','; //2
S:=S+memTblVou.fieldByName('ORDNO').AsString+','; //3
S:=S+memTblVou.fieldByName('ATTACHS').AsString+','; //4
S:=S+qryVouitems.fieldByName('Explan').AsString+','; //5
S:=S+Trim(qryVouitems.fieldByName('ACCID').AsString)+','; //6
S:=S+qryVouitems.fieldByName('AMTDR').AsString+','; //7
S:=S+qryVouitems.fieldByName('AMTCR').AsString+',,'; //8 9
S:=S+FloattoStr(qryVouitems.fieldByName('FCYDR').AsFloat+qryVouitems.fieldByName('FCYCR').AsFloat)+','; //10
S:=S+qryVouitems.fieldByName('FCYExRate').AsString; // 11 <20><><EFBFBD><EFBFBD>
S:=S+','+memTblVou.fieldByName('PREPARED').AsString;
S:=S+',,'; //F12<31>Ƶ<EFBFBD><C6B5><EFBFBD>","F13<31><33><EFBFBD>ʽ","F14Ʊ<34><C6B1>","F15<31><35><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"
S:=S+copy(qryVouitems.FieldByName('BSNO').AsString,1,10); //<2F><><EFBFBD>غ<EFBFBD><D8BA><EFBFBD>
{
S:=S+qryVouitems.FieldByName('FSETTLCODE').AsString+',';
S:=S+qryVouitems.FieldByName('FSETTLENO').AsString+',,';
}
if (Trim(qryVouitems.fieldByName('ACCID').AsString)=AccInfo.DebitAccIDU)
or (Trim(qryVouitems.fieldByName('ACCID').AsString)=AccInfo.DebitAccID)
or (Trim(qryVouitems.fieldByName('ACCID').AsString)=AccInfo.CreditAccIDU)
or (Trim(qryVouitems.fieldByName('ACCID').AsString)=AccInfo.CreditAccID) then
begin
S:=S+''+',';
S:=S+FormatDateTime('YYYY-MM-DD',memTblVou.FieldByName('VouDate').AsDateTime)+',';
end
else
begin
S:=S+',';
S:=S+',';
end;
S:=S+qryVouitems.fieldByName('DeptID').AsString+',';
S:=S+qryVouitems.fieldByName('EmplID').AsString+',';
if Trim(qryVouitems.fieldByName('QTYSPECS').AsString)=Trim(AccInfo.CustKindName) then
begin
S:=S+qryVouitems.fieldByName('CORPID').AsString+',,';
end
else
if Trim(qryVouitems.fieldByName('QTYSPECS').AsString)=Trim(AccInfo.SuppKindName) then
begin
S:=S+','+qryVouitems.fieldByName('CORPID').AsString+',';
end
else
begin
S:=S+',,';
end;
S:=S+','+qryVouitems.fieldByName('Field1').AsString;
{
S:=S+FormatDateTime('YY-MM-DD',memTblVou.FieldByName('VouDate').AsDateTime)+',';
S:=S+trim(memTblVou.fieldByName('VKNO').AsString)+',';
S:=S+memTblVou.fieldByName('ORDNO').AsString+',';
S:=S+memTblVou.fieldByName('ATTACHS').AsString+',';
S:=S+qryVouitems.fieldByName('Explan').AsString+',';
S:=S+Trim(qryVouitems.fieldByName('ACCID').AsString)+',';
S:=S+qryVouitems.fieldByName('AMTDR').AsString+',';
S:=S+qryVouitems.fieldByName('AMTCR').AsString+',,';
S:=S+FloattoStr(qryVouitems.fieldByName('FCYDR').AsFloat+qryVouitems.fieldByName('FCYCR').AsFloat)+',';
S:=S+qryVouitems.fieldByName('FCYExRate').AsString+',,';
S:=S+',';
// S:=S+qryVouitems.FieldByName('FSETTLCODE').AsString+',';
S:=S+qryVouitems.FieldByName('FSETTLENO').AsString+',,';
S:=S+qryVouitems.fieldByName('DeptID').AsString+',';
S:=S+qryVouitems.fieldByName('EmplID').AsString+',';
if Trim(qryVouitems.fieldByName('QTYSPECS').AsString)<>'' then
begin
S:=S+qryVouitems.fieldByName('CORPID').AsString+',,';
end
else
begin
S:=S+',,';
end;
}
{
if qryVouitems.FieldByName('CorpBF').AsString='T' then
S:=S+','+qryVouitems.fieldByName('CORPID').AsString+','
else
S:=S+qryVouitems.fieldByName('CORPID').AsString+',,';
}
{
if (trim(qryVouitems.FieldByName('AccID').AsString)=trim(AccInfo.DebitAccID)) or (trim(qryVouitems.FieldByName('AccID').AsString)=trim(AccInfo.DebitAccIDU)) then begin
S:=S+qryVouitems.fieldByName('CORPID').AsString+',,';
end;
if (trim(qryVouitems.FieldByName('AccID').AsString)=trim(AccInfo.CreditAccID)) or (trim(qryVouitems.FieldByName('AccID').AsString)=trim(AccInfo.CreditAccIDU)) then begin
S:=S+','+qryVouitems.fieldByName('CORPID').AsString+',';
end;
}
SL.Add(S);
qryVouitems.Next;
end;
aQuery.Parameters.ParamByName('OrdNO').value:=qryVouitems.fieldByName('OrdNO').AsInteger;
aQuery.ExecSQL;
end;
memTblVou.Next;
end;
if sl.Count<>1 then begin
saveDialog1.Files.Add(FormatDateTime('YYMMDD', Date)+'.TXT');
if SaveDialog1.Execute then begin
sl.SaveToFile(SaveDialog1.FileName+'.txt');
MessageDlg('<27>Ѿ<EFBFBD><D1BE><EFBFBD>ƾ֤<C6BE><D6A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>'+SaveDialog1.FileName,mtInformation,[mbOK],0);
end;
end;
finally
FreeAndNil(aQuery);
FreeAndNil(Sl);
end;
bsSkinButton8Click(bsSkinButton8);
end;
procedure Tfrm_cw_pingzheng_gj.U8103;
var
aQuery:TADOQuery;
Str,S,source,dbffile,exepath,adbftable:String;
connectstr:wideString;
selcount,itemno:integer;
sl:TStrings;
function GetSelCount:integer;
begin
result:=0;
memtblvou.First;
while not memtblvou.Eof do begin
result:=result+1;
memtblvou.Next;
end;
end;
begin
{
if not selectDirectory('ѡ<>񵼳<EFBFBD><F1B5BCB3>ļ<EFBFBD>Ŀ¼','',source) then begin
messagedlg( '<27><><EFBFBD><EFBFBD>ѡ<EFBFBD>񵼳<EFBFBD>·<EFBFBD><C2B7><EFBFBD><EFBFBD><EFBFBD>ܵ<EFBFBD><DCB5><EFBFBD>ƾ֤<C6BE>ļ<EFBFBD>',mterro,mbyes,0);
exit;
end;
}
if not memtblVou.Active then exit;
selcount:=GetSelCount;
if selcount=0 then begin
messagedlg( 'û<><C3BB>ѡ<EFBFBD><D1A1>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƾ֤<C6BE><D6A4><EFBFBD><EFBFBD><EFBFBD>ܵ<EFBFBD><DCB5><EFBFBD>',mtError,[mbyes],0);
exit;
end;
aQuery:=CreateADOQuery;
aQuery.SQL.Add('Update Vouchers set Status=1 where ordno=:OrdNo');
sl:=TStringList.Create;
sl.Add('<27><><EFBFBD><EFBFBD>ƾ֤,V800');
memtblVou.First;
try
while not memtblVou.Eof do begin
if memtblVou.FieldByName('Selected').AsInteger=1 then begin
qryVouitems.First;
while not qryVouitems.Eof do begin
S:='';
S:=S+FormatDateTime('YYYY-MM-DD',memTblVou.FieldByName('VouDate').AsDateTime)+','; //1
S:=S+trim(memTblVou.fieldByName('VKNO').AsString)+','; //2
S:=S+memTblVou.fieldByName('ORDNO').AsString+','; //3
S:=S+memTblVou.fieldByName('ATTACHS').AsString+','; //4
S:=S+qryVouitems.fieldByName('Explan').AsString+','; //5
S:=S+Trim(qryVouitems.fieldByName('ACCID').AsString)+','; //6
S:=S+qryVouitems.fieldByName('AMTDR').AsString+','; //7
S:=S+qryVouitems.fieldByName('AMTCR').AsString+',,'; //8 9
S:=S+FloattoStr(qryVouitems.fieldByName('FCYDR').AsFloat+qryVouitems.fieldByName('FCYCR').AsFloat)+','; //10
S:=S+qryVouitems.fieldByName('FCYExRate').AsString; // 11 <20><><EFBFBD><EFBFBD>
S:=S+',,,'; //F12<31>Ƶ<EFBFBD><C6B5><EFBFBD>","F13<31><33><EFBFBD>ʽ","F14Ʊ<34><C6B1>","F15<31><35><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"
// S:=S+qryVouitems.FieldByName('FSETTLENO').AsString; //<2F><><EFBFBD>غ<EFBFBD><D8BA><EFBFBD>
{
S:=S+qryVouitems.FieldByName('FSETTLCODE').AsString+',';
S:=S+qryVouitems.FieldByName('FSETTLENO').AsString+',,';
}
if (Trim(qryVouitems.fieldByName('ACCID').AsString)=AccInfo.DebitAccIDU)
or (Trim(qryVouitems.fieldByName('ACCID').AsString)=AccInfo.DebitAccID)
or (Trim(qryVouitems.fieldByName('ACCID').AsString)=AccInfo.CreditAccIDU)
or (Trim(qryVouitems.fieldByName('ACCID').AsString)=AccInfo.CreditAccID) then
begin
S:=S+''+',';
S:=S+FormatDateTime('YYYY-MM-DD',memTblVou.FieldByName('VouDate').AsDateTime)+',';
end
else
begin
S:=S+',';
S:=S+',';
end;
S:=S+qryVouitems.fieldByName('DeptID').AsString+',';
S:=S+qryVouitems.fieldByName('EmplID').AsString+',';
if Trim(qryVouitems.fieldByName('QTYSPECS').AsString)=Trim(AccInfo.SuppKindName) then
begin
S:=S+','+qryVouitems.fieldByName('CORPID').AsString+',';
end
else
if Trim(qryVouitems.fieldByName('QTYSPECS').AsString)=Trim(AccInfo.CustKindName) then
begin
S:=S+qryVouitems.fieldByName('CORPID').AsString+',,';
end
else
begin
S:=S+',,';
end;
{
S:=S+FormatDateTime('YY-MM-DD',memTblVou.FieldByName('VouDate').AsDateTime)+',';
S:=S+trim(memTblVou.fieldByName('VKNO').AsString)+',';
S:=S+memTblVou.fieldByName('ORDNO').AsString+',';
S:=S+memTblVou.fieldByName('ATTACHS').AsString+',';
S:=S+qryVouitems.fieldByName('Explan').AsString+',';
S:=S+Trim(qryVouitems.fieldByName('ACCID').AsString)+',';
S:=S+qryVouitems.fieldByName('AMTDR').AsString+',';
S:=S+qryVouitems.fieldByName('AMTCR').AsString+',,';
S:=S+FloattoStr(qryVouitems.fieldByName('FCYDR').AsFloat+qryVouitems.fieldByName('FCYCR').AsFloat)+',';
S:=S+qryVouitems.fieldByName('FCYExRate').AsString+',,';
S:=S+',';
// S:=S+qryVouitems.FieldByName('FSETTLCODE').AsString+',';
S:=S+qryVouitems.FieldByName('FSETTLENO').AsString+',,';
S:=S+qryVouitems.fieldByName('DeptID').AsString+',';
S:=S+qryVouitems.fieldByName('EmplID').AsString+',';
if Trim(qryVouitems.fieldByName('QTYSPECS').AsString)<>'' then
begin
S:=S+qryVouitems.fieldByName('CORPID').AsString+',,';
end
else
begin
S:=S+',,';
end;
}
{
if qryVouitems.FieldByName('CorpBF').AsString='T' then
S:=S+','+qryVouitems.fieldByName('CORPID').AsString+','
else
S:=S+qryVouitems.fieldByName('CORPID').AsString+',,';
}
{
if (trim(qryVouitems.FieldByName('AccID').AsString)=trim(AccInfo.DebitAccID)) or (trim(qryVouitems.FieldByName('AccID').AsString)=trim(AccInfo.DebitAccIDU)) then begin
S:=S+qryVouitems.fieldByName('CORPID').AsString+',,';
end;
if (trim(qryVouitems.FieldByName('AccID').AsString)=trim(AccInfo.CreditAccID)) or (trim(qryVouitems.FieldByName('AccID').AsString)=trim(AccInfo.CreditAccIDU)) then begin
S:=S+','+qryVouitems.fieldByName('CORPID').AsString+',';
end;
}
SL.Add(S);
qryVouitems.Next;
end;
aQuery.Parameters.ParamByName('OrdNO').value:=qryVouitems.fieldByName('OrdNO').AsInteger;
aQuery.ExecSQL;
end;
memTblVou.Next;
end;
if sl.Count<>1 then begin
saveDialog1.Files.Add(FormatDateTime('YYMMDD', Date)+'.TXT');
if SaveDialog1.Execute then begin
sl.SaveToFile(SaveDialog1.FileName+'.txt');
MessageDlg('<27>Ѿ<EFBFBD><D1BE><EFBFBD>ƾ֤<C6BE><D6A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>'+SaveDialog1.FileName,mtInformation,[mbOK],0);
end;
end;
finally
FreeAndNil(aQuery);
FreeAndNil(Sl);
end;
bsSkinButton8Click(bsSkinButton8);
end;
procedure Tfrm_cw_pingzheng_gj.kingdee;
var
aQuery:TADOQuery;
Str,source,dbffile,exepath,adbftable:String;
connectstr:wideString;
selcount,itemno:integer;
function GetSelCount:integer;
begin
result:=0;
memtblvou.First;
while not memtblvou.Eof do begin
result:=result+1;
memtblvou.Next;
end;
end;
begin
{
if not selectDirectory('ѡ<>񵼳<EFBFBD><F1B5BCB3>ļ<EFBFBD>Ŀ¼','',source) then begin
messagedlg( '<27><><EFBFBD><EFBFBD>ѡ<EFBFBD>񵼳<EFBFBD>·<EFBFBD><C2B7><EFBFBD><EFBFBD><EFBFBD>ܵ<EFBFBD><DCB5><EFBFBD>ƾ֤<C6BE>ļ<EFBFBD>',mterro,mbyes,0);
exit;
end;
}
if not memtblVou.Active then exit;
selcount:=GetSelCount;
if selcount=0 then begin
messagedlg( 'û<><C3BB>ѡ<EFBFBD><D1A1>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƾ֤<C6BE><D6A4><EFBFBD><EFBFBD><EFBFBD>ܵ<EFBFBD><DCB5><EFBFBD>',mtError,[mbyes],0);
exit;
end;
{
cwconnect.Connected:=false;
tblvouitems.Active:=false;
exepath:=extractfilepath(paramstr(0))+'vouitems.dbf';
if not fileexists(exepath) then begin
messagedlg( 'ԭʼƾ֤<C6BE>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',mtError,[mbyes],0);
exit;
end;
source:=extractfilepath(exepath);
adbftable:=extractfilename(exepath);
connectstr:='Provider=Microsoft.Jet.OLEDB.4.0;User ID=Admin;Data Source='+source+';Mode=Share Deny None;';
connectstr:=connectstr+'Extended Properties=dBase 5.0;Jet OLEDB:System database="";Jet OLEDB:Registry Path="";Jet OLEDB:Database Password="";Jet OLEDB:Engine Type=18;Jet OLEDB:Database Locking Mode=0;Jet OLEDB:Global Partial Bulk Ops=2;';
connectstr:=connectstr+'Jet OLEDB:Global Bulk Transactions=1;Jet OLEDB:New Database Password="";Jet OLEDB:Create System Database=False;Jet OLEDB:Encrypt Database=False;Jet OLEDB:Compact Without Replica Repair=False;Jet OLEDB:SFP=False';// 'Provider=Microsoft.Jet.OLEDB.4.0;Data Source='+source+';Extended Properties=dBase 5.0;Persist Security Info=False';
cwconnect.ConnectionString:=connectstr;
tblvouitems.TableName:=adbftable;
cwconnect.Connected:=true;
}
DatabaseVouitems.Connected:=true;
// tblvouitems.Active:=true;
{
Query1.Close;
Query1.SQL.Clear;
Query1.SQL.Add('delete from vouitems');
Query1.ExecSQL;
}
tblVouitems.Active:=true;
tblVouitems.First;
while not tblVouitems.Eof do begin
tblvouitems.Delete;
end;
memtblVou.First;
aQuery:=CreateADOQuery;
aQuery.SQL.Add('Update Vouchers set Status=1 where ordno=:OrdNo');
if not ASSIGNED(frm_sys_progress) then
frm_sys_progress:=tfrm_sys_progress.Create(self);
try
frm_sys_progress.bsSkinGauge1.ProgressText:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƾ֤<C6BE><D6A4><EFBFBD>Ժ󡣡<D4BA><F3A1A3A1><EFBFBD>';
frm_sys_progress.Show;
frm_sys_progress.bsSkinGauge1.MaxValue:=selcount;
frm_sys_progress.bsSkinGauge1.MinValue:=0;
frm_sys_progress.bsSkinGauge1.Value:=0;
frm_sys_progress.Update;
while not memtblVou.Eof do begin
if memtblVou.FieldByName('Selected').AsInteger=1 then begin
qryVouitems.First;
itemno:=0;
while not qryVouitems.Eof do
begin
if (qryVouitems.fieldByName('AMTDR').AsFloat<>0) or (qryVouitems.fieldByName('AMTCR').AsFloat<>0) then
begin
tblVouitems.Insert;
tblVouitems.FieldByName('FDATE').AsDateTime:=memTblVou.fieldByName('VouDate').AsDateTime;
tblVouitems.FieldByName('FTRANSDATE').AsDateTime:=memTblVou.fieldByName('VouDate').AsDateTime;
tblVouitems.FieldByName('FPeriod').Asinteger:=memTblVou.fieldByName('AccMonth').AsInteger;
tblVouitems.FieldByName('FGROUP').AsString:=memTblVou.FieldByName('VKNO').AsString;
tblVouitems.FieldByName('FNUM').AsInteger:=qryVouitems.FieldByName('OrdNO').AsInteger;
tblVouitems.FieldByName('FENTRYID').AsInteger:=itemno;
itemno:=itemno+1;
tblVouitems.FieldByName('FEXP').AsString:=qryVouitems.FieldByName('ExPlan').AsString;
tblVouitems.FieldByName('FACCTID').AsString:=qryVouitems.fieldByName('ACCID').AsString;
tblVouitems.FieldByName('FTRANSID').AsString:=qryVouitems.FieldByName('bsNo').AsString;
if (trim(qryVouitems.FieldByName('AccID').AsString)=trim(AccInfo.DebitAccID))
or (trim(qryVouitems.FieldByName('AccID').AsString)=trim(AccInfo.CreditAccID))
or (trim(qryVouitems.FieldByName('AccID').AsString)=trim(AccInfo.DebitAccIDU))
or (trim(qryVouitems.FieldByName('AccID').AsString)=trim(AccInfo.CreditAccIDU))
then
begin
{
case AccInfo.ACCSys of
3: //k3
begin
tblVouitems.FieldByName('FCLSNAME1').AsString:=qryVouitems.FieldByName('QTYSPECS').AsString; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ
tblVouitems.FieldByName('FOBJID1').AsString:=qryVouitems.FieldByName('CorpID').AsString;
tblVouitems.FieldByName('FOBJNAME1').AsString:=qryVouitems.FieldByName('CorpID').AsString;
end;
end;
}
tblVouitems.FieldByName('FCLSNAME1').AsString:=qryVouitems.FieldByName('QTYSPECS').AsString; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ
tblVouitems.FieldByName('FOBJID1').AsString:=qryVouitems.FieldByName('CorpID').AsString;
tblVouitems.FieldByName('FOBJNAME1').AsString:=qryVouitems.FieldByName('CorpID').AsString;
end;
if (Trim(qryVouitems.fieldByName('ACCID').AsString)=Trim(AccInfo.ProfitAccID))
or (Trim(qryVouitems.fieldByName('ACCID').AsString)=Trim(AccInfo.ImpProfitAccID))
or (Trim(qryVouitems.fieldByName('ACCID').AsString)=Trim(AccInfo.ProfitAccIDU))
or (Trim(qryVouitems.fieldByName('ACCID').AsString)=Trim(AccInfo.ImpProfitAccIDU))
then
begin
if t_Accitems.Locate('accid',qryVouitems.fieldByName('ACCID').AsString,[]) then
begin
if t_Accitems.FieldByName('EmplACC').AsString='T' then
begin
tblVouitems.FieldByName('FCLSNAME1').AsString:=AccInfo.SaleKindName; //ҵ<><D2B5>Ա
tblVouitems.FieldByName('FOBJID1').AsString:=qryVouitems.FieldByName('emplID').AsString;
tblVouitems.FieldByName('FOBJNAME1').AsString:=qryVouitems.FieldByName('emplID').AsString;
end;
end;
end;
if t_Accitems.Locate('accid',qryVouitems.fieldByName('ACCID').AsString,[]) then
begin
if t_Accitems.FieldByName('CORPACC').AsString='T' then
begin
tblVouitems.FieldByName('FCLSNAME1').AsString:=qryVouitems.FieldByName('QTYSPECS').AsString; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ
tblVouitems.FieldByName('FOBJID1').AsString:=qryVouitems.FieldByName('CorpID').AsString;
tblVouitems.FieldByName('FOBJNAME1').AsString:=qryVouitems.FieldByName('CorpID').AsString;
end;
end;
if (qryVouitems.FieldByName('FCYDR').AsFloat<>0) OR (qryVouitems.FieldByName('FCYCR').AsFloat<>0) then begin
tblVouitems.FieldByName('FCYID').AsString:='USD';
tblVouitems.FieldByName('FFCYAMT').AsFloat:=qryVouitems.fieldByName('FCYDR').AsFloat+qryVouitems.fieldByName('FCYCR').AsFloat;
tblVouitems.FieldByName('FEXCHRATE').AsFloat:=qryVouitems.fieldByName('FCYEXRATE').AsFloat;
end else begin
tblVouitems.FieldByName('FCYID').AsString:='RMB';
tblVouitems.FieldByName('FFCYAMT').AsFloat:=qryVouitems.fieldByName('AMTDR').AsFloat+qryVouitems.fieldByName('AMTCR').AsFloat;
tblVouitems.FieldByName('FEXCHRATE').AsFloat:=1;
end;
tblVouitems.FieldByName('FPRICE').AsFloat:=0;
tblVouitems.FieldByName('FDebit').AsFloat:=qryVouitems.fieldByName('AMTDR').AsFloat;
tblVouitems.FieldByName('FCredit').AsFloat:=qryVouitems.fieldByName('AMTCR').AsFloat;
tblVouitems.FieldByName('FDC').AsString:=qryVouitems.FieldByName('DC').AsString;
tblVouitems.FieldByName('FATTCHMENT').Asinteger:=memTblVou.FieldByName('ATTACHS').Asinteger;;
tblVouitems.FieldByName('FPOSTED').AsBoolean:=False;
tblVouitems.FieldByName('FDELETED').AsBoolean:=False;
tblVouitems.FieldByName('FSERIALNO').Asinteger:=qryVouitems.FieldByName('OrdNO').AsInteger;
tblVouitems.FieldByName('FPREPARE').AsString:=memtblVou.FieldByName('PREPARED').AsString;
tblVouitems.FieldByName('FSETTLCODE').AsString:=qryVouitems.FieldByName('FSETTLCODE').AsString;
tblVouitems.FieldByName('FSETTLENO').AsString:=qryVouitems.FieldByName('FSETTLENO').AsString;
tblVouitems.Post;
end;
qryVouitems.Next;
end;
aQuery.Parameters.ParamByName('OrdNO').value:=qryVouitems.fieldByName('OrdNO').AsInteger;
aQuery.ExecSQL;
frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1;
end;
memTblVou.Next;
end;
finally
tblVouitems.Active:=false;
DatabaseVouitems.Connected:=false;
DatabaseVouitems.Close;
FreeAndNil(aQuery);
freeandnil(frm_sys_progress);
MessageDlg('<27>Ѿ<EFBFBD><D1BE><EFBFBD>ƾ֤<C6BE><D6A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>ƾ֤<C6BE>ļ<EFBFBD><C4BC><EFBFBD>',mtInformation,[mbOK],0);
bsSkinButton8Click(bsSkinButton8);
end;
end;
procedure Tfrm_cw_pingzheng_gj.DBGridEh2DrawColumnCell(Sender: TObject;
const Rect: TRect; DataCol: Integer; Column: TColumnEh;
State: TGridDrawState);
begin
with TDBGridEh(Sender), Canvas, Brush do begin
case memTblVou.FieldByName('Status').AsInteger of
1 : Color:=$00FBE8FF;//<2F><><EFBFBD><EFBFBD>
end;
if (gdSelected in State)or(gdFocused in State) then begin
Font.Color:=Color;
Color:=$00C08080;
end;
DefaultDrawColumnCell(Rect, dataCol,Column, State);
end;
end;
procedure Tfrm_cw_pingzheng_gj.DBGridEh1DrawColumnCell(Sender: TObject;
const Rect: TRect; DataCol: Integer; Column: TColumnEh;
State: TGridDrawState);
begin
with TDBGridEh(Sender), Canvas, Brush do begin
if t_op_seae['<27><><EFBFBD><EFBFBD>'] then
Color:=$00FBE8FF;//<2F><><EFBFBD><EFBFBD>
if (gdSelected in State)or(gdFocused in State) then begin
Font.Color:=Color;
Color:=$00C08080;
end;
DefaultDrawColumnCell(Rect, dataCol,Column, State);
end;
end;
procedure Tfrm_cw_pingzheng_gj.DBGridEh4DrawColumnCell(Sender: TObject;
const Rect: TRect; DataCol: Integer; Column: TColumnEh;
State: TGridDrawState);
begin
with TDBGridEh(Sender), Canvas, Brush do begin
if t_op_seai['<27><><EFBFBD><EFBFBD>'] then
Color:=$00FBE8FF;//<2F><><EFBFBD><EFBFBD>
if (gdSelected in State)or(gdFocused in State) then begin
Font.Color:=Color;
Color:=$00C08080;
end;
DefaultDrawColumnCell(Rect, dataCol,Column, State);
end;
end;
procedure Tfrm_cw_pingzheng_gj.DBGridEh5DrawColumnCell(Sender: TObject;
const Rect: TRect; DataCol: Integer; Column: TColumnEh;
State: TGridDrawState);
begin
with TDBGridEh(Sender), Canvas, Brush do begin
if t_op_aire['<27><><EFBFBD><EFBFBD>'] then
Color:=$00FBE8FF;//<2F><><EFBFBD><EFBFBD>
if (gdSelected in State)or(gdFocused in State) then begin
Font.Color:=Color;
Color:=$00C08080;
end;
DefaultDrawColumnCell(Rect, dataCol,Column, State);
end;
end;
procedure Tfrm_cw_pingzheng_gj.DBGridEh6DrawColumnCell(Sender: TObject;
const Rect: TRect; DataCol: Integer; Column: TColumnEh;
State: TGridDrawState);
begin
with TDBGridEh(Sender), Canvas, Brush do begin
if t_op_airi['<27><><EFBFBD><EFBFBD>'] then
Color:=$00FBE8FF;//<2F><><EFBFBD><EFBFBD>
if (gdSelected in State)or(gdFocused in State) then begin
Font.Color:=Color;
Color:=$00C08080;
end;
DefaultDrawColumnCell(Rect, dataCol,Column, State);
end;
end;
procedure Tfrm_cw_pingzheng_gj.DBGridEh7DrawColumnCell(Sender: TObject;
const Rect: TRect; DataCol: Integer; Column: TColumnEh;
State: TGridDrawState);
begin
with TDBGridEh(Sender), Canvas, Brush do begin
if t_op_balance['<27><><EFBFBD><EFBFBD>'] then
Color:=$00FBE8FF;//<2F><><EFBFBD><EFBFBD>
if (gdSelected in State)or(gdFocused in State) then begin
Font.Color:=clGreen;
Color:=clSkyBlue;
// Color:=$00C08080;
end;
DefaultDrawColumnCell(Rect, dataCol,Column, State);
end;
end;
procedure Tfrm_cw_pingzheng_gj.bsSkinButton12Click(Sender: TObject);
var
i,ordno:integer;
aQuery:TAdoQuery;
begin
NewBsVoucher(3,'t_op_aire','<27><><EFBFBD>˵<EFBFBD><CBB5><EFBFBD>',dxDBGrid6,t_op_aire);
{
if wwDBDateTimePicker21.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 RxDBLookupCombo6.DisplayValue='' then begin
MessageDlg('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƶ<EFBFBD><C6B5>ˣ<EFBFBD>',mterror,[mbyes],0);
exit;
end;
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_op_aire set <20><><EFBFBD><EFBFBD>=1,<2C><><EFBFBD><EFBFBD>ƾ֤=:<3A><><EFBFBD><EFBFBD>ƾ֤ where ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>=:ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
VoucherDate:=wwDBDateTimePicker21.Date;
if DBGridEh5.SelectedRows.Count>1 then begin
if not ASSIGNED(frm_sys_progress) then
frm_sys_progress:=tfrm_sys_progress.Create(self);
try
frm_sys_progress.bsSkinGauge1.ProgressText:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƾ֤<C6BE><D6A4><EFBFBD>Ժ󡣡<D4BA><F3A1A3A1><EFBFBD>';
frm_sys_progress.Show;
frm_sys_progress.bsSkinGauge1.MaxValue:=DBGridEh5.SelectedRows.Count;
frm_sys_progress.bsSkinGauge1.MinValue:=0;
frm_sys_progress.bsSkinGauge1.Value:=0;
frm_sys_progress.Update;
for i:=0 to DBGridEh5.SelectedRows.Count-1 do begin
t_op_aire.GotoBookmark(Pointer(DBGridEh5.SelectedRows.Items[I]));
if t_op_aire['<27><><EFBFBD><EFBFBD>'] then begin
MessageDlg('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:'+t_op_aire['ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']+'<27>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD><EFBFBD>ƾ֤<C6BE><D6A4><EFBFBD>޷<EFBFBD><DEB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɣ<EFBFBD>',mterror,[mbyes],0);
end else begin
NewDrCrVou(t_op_aire,3,t_op_aire['<27><><EFBFBD>˵<EFBFBD><CBB5><EFBFBD>'],wwDBDateTimePicker21.Date,'');
aQuery.Parameters.ParamByName('<27><><EFBFBD><EFBFBD>ƾ֤').Value:=dmacc.ADOTblVou.fieldbyname('ordno').AsString;
aQuery.Parameters.ParamByName('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').Value:=t_op_aire.fieldbyname('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString;
aQuery.ExecSQL;
end;
frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1;
end;
finally
freeAndNil(frm_sys_progress);
end;
end else begin
NewDrCrVou(t_op_aire,3,t_op_aire['<27><><EFBFBD>˵<EFBFBD><CBB5><EFBFBD>'],wwDBDateTimePicker21.Date,'');
aQuery.Parameters.ParamByName('<27><><EFBFBD><EFBFBD>ƾ֤').Value:=dmacc.ADOTblVou.fieldbyname('ordno').AsString;
aQuery.Parameters.ParamByName('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').Value:=t_op_aire.fieldbyname('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString;
aQuery.ExecSQL;
end;
finally
dmAcc.AdotblVouItems.Close;
dmAcc.AdotblVou.Close;
freeAndNil(dmacc);
end;
bsSkinButton9.OnClick(sender);
}
end;
procedure Tfrm_cw_pingzheng_gj.bsSkinButton16Click(Sender: TObject);
var
i,ordno:integer;
aQuery:TAdoQuery;
begin
NewBsVoucher(4,'t_op_airi','<27><><EFBFBD>˵<EFBFBD><CBB5><EFBFBD>',dxDBGrid7,t_op_airi);
{
if wwDBDateTimePicker21.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 RxDBLookupCombo6.DisplayValue='' then begin
MessageDlg('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƶ<EFBFBD><C6B5>ˣ<EFBFBD>',mterror,[mbyes],0);
exit;
end;
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_op_airi set <20><><EFBFBD><EFBFBD>=1,<2C><><EFBFBD><EFBFBD>ƾ֤=:<3A><><EFBFBD><EFBFBD>ƾ֤ where ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>=:ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
VoucherDate:=wwDBDateTimePicker21.Date;
if DBGridEh6.SelectedRows.Count>1 then begin
if not ASSIGNED(frm_sys_progress) then
frm_sys_progress:=tfrm_sys_progress.Create(self);
try
frm_sys_progress.bsSkinGauge1.ProgressText:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƾ֤<C6BE><D6A4><EFBFBD>Ժ󡣡<D4BA><F3A1A3A1><EFBFBD>';
frm_sys_progress.Show;
frm_sys_progress.bsSkinGauge1.MaxValue:=DBGridEh6.SelectedRows.Count;
frm_sys_progress.bsSkinGauge1.MinValue:=0;
frm_sys_progress.bsSkinGauge1.Value:=0;
frm_sys_progress.Update;
for i:=0 to DBGridEh6.SelectedRows.Count-1 do begin
t_op_airi.GotoBookmark(Pointer(DBGridEh6.SelectedRows.Items[I]));
if t_op_airi['<27><><EFBFBD><EFBFBD>'] then begin
MessageDlg('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:'+t_op_airi['ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']+'<27>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD><EFBFBD>ƾ֤<C6BE><D6A4><EFBFBD>޷<EFBFBD><DEB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɣ<EFBFBD>',mterror,[mbyes],0);
end else begin
NewDrCrVou(t_op_airi,4,t_op_airi['<27><><EFBFBD>˵<EFBFBD><CBB5><EFBFBD>'],wwDBDateTimePicker21.Date,'');
aQuery.Parameters.ParamByName('<27><><EFBFBD><EFBFBD>ƾ֤').Value:=dmacc.ADOTblVou.fieldbyname('ordno').AsString;
aQuery.Parameters.ParamByName('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').Value:=t_op_airi.fieldbyname('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString;
aQuery.ExecSQL;
end;
frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1;
end;
finally
freeAndNil(frm_sys_progress);
end;
end else begin
NewDrCrVou(t_op_airi,4,t_op_airi['<27><><EFBFBD>˵<EFBFBD><CBB5><EFBFBD>'],wwDBDateTimePicker21.Date,'');
aQuery.Parameters.ParamByName('<27><><EFBFBD><EFBFBD>ƾ֤').Value:=dmacc.ADOTblVou.fieldbyname('ordno').AsString;
aQuery.Parameters.ParamByName('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').Value:=t_op_airi.fieldbyname('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString;
aQuery.ExecSQL;
end;
finally
dmAcc.AdotblVouItems.Close;
dmAcc.AdotblVou.Close;
freeAndNil(dmacc);
end;
bsSkinButton14.OnClick(sender);
}
end;
procedure Tfrm_cw_pingzheng_gj.bsSkinButton17Click(Sender: TObject);
procedure deleteBusiCardVt(ordno:integer);
var
aQuery:TAdoQuery;
begin
aQuery:=CreateAdoQuery;
try
with aQuery do begin
close;SQl.Clear;
SQL.Add('delete from vouchers where ORDNO='+inttostr(OrdNo));
ExecSQL;
close;SQl.Clear;
SQL.Add('update t_op_seae set <20><><EFBFBD><EFBFBD>=0,<2C><><EFBFBD><EFBFBD>ƾ֤='''' where <20><><EFBFBD><EFBFBD>ƾ֤='''+inttostr(OrdNo)+'''');
ExecSQL;
close;SQl.Clear;
SQL.Add('update t_op_seai set <20><><EFBFBD><EFBFBD>=0,<2C><><EFBFBD><EFBFBD>ƾ֤='''' where <20><><EFBFBD><EFBFBD>ƾ֤='''+inttostr(OrdNo)+'''');
ExecSQL;
close;SQl.Clear;
SQL.Add('update t_op_aire set <20><><EFBFBD><EFBFBD>=0,<2C><><EFBFBD><EFBFBD>ƾ֤='''' where <20><><EFBFBD><EFBFBD>ƾ֤='''+inttostr(OrdNo)+'''');
ExecSQL;
close;SQl.Clear;
SQL.Add('update t_op_airi set <20><><EFBFBD><EFBFBD>=0,<2C><><EFBFBD><EFBFBD>ƾ֤='''' where <20><><EFBFBD><EFBFBD>ƾ֤='''+inttostr(OrdNo)+'''');
ExecSQL;
close;SQl.Clear;
SQL.Add('update t_ch_invoice set <20><><EFBFBD><EFBFBD>=0,<2C><><EFBFBD><EFBFBD>ƾ֤='''' where <20><><EFBFBD><EFBFBD>ƾ֤='''+inttostr(OrdNo)+'''');
ExecSQL;
close;SQl.Clear;
SQL.Add('update t_ch_invoice_hexiao set <20><><EFBFBD><EFBFBD>=0,<2C><><EFBFBD><EFBFBD>ƾ֤='''' where <20><><EFBFBD><EFBFBD>ƾ֤='''+inttostr(OrdNo)+'''');
ExecSQL;
end;
finally
FreeAndNil(aQuery);
end;
end;
procedure deleteStlVt(ordno:integer);
var
aQuery:TAdoQuery;
begin
aQuery:=CreateAdoQuery;
try
with aQuery do begin
close;SQl.Clear;
SQL.Add('update t_ch_balance set <20><><EFBFBD><EFBFBD>=0,<2C><><EFBFBD><EFBFBD>ƾ֤='''' where <20><><EFBFBD><EFBFBD>ƾ֤='''+inttostr(OrdNo)+'''');
ExecSQL;
close;SQl.Clear;
SQL.Add('delete from vouchers where ORDNO='+inttostr(OrdNo));
ExecSQL;
end;
finally
FreeAndNil(aQuery);
end;
end;
procedure deleteprecost(ordno:integer);
var
aQuery:TAdoQuery;
begin
aQuery:=CreateAdoQuery;
try
with aQuery do begin
close;SQl.Clear;
SQL.Add('update t_ch_precost set <20><><EFBFBD><EFBFBD>״̬=''¼<><C2BC>״̬'' , <20><><EFBFBD><EFBFBD>=0,<2C><><EFBFBD><EFBFBD>ƾ֤='''' where <20><><EFBFBD><EFBFBD>ƾ֤='''+inttostr(OrdNo)+'''');
ExecSQL;
close;SQl.Clear;
SQL.Add('delete from vouchers where ORDNO='+inttostr(OrdNo));
ExecSQL;
end;
finally
FreeAndNil(aQuery);
end;
end;
procedure deleteOpFee(ordno,AccYear,AccMonth:integer);
var
aQuery:TAdoQuery;
begin
aQuery:=CreateAdoQuery;
try
with aQuery do begin
close;SQl.Clear;
SQL.Add('update t_Op_Fee set <20><><EFBFBD><EFBFBD>=0,<2C><><EFBFBD><EFBFBD>ƾ֤=''''');
SQL.Add('where <20><><EFBFBD><EFBFBD>ƾ֤='''+inttostr(OrdNo)+'''');
SQL.Add(' and Accyear=:Accyear and AccMonth=:AccMonth');
Parameters.ParamByName('AccYear').Value:=AccYear;
Parameters.ParamByName('AccMonth').Value:=AccMonth;
ExecSQL;
close;SQl.Clear;
SQL.Add('delete from vouchers where ORDNO='+inttostr(OrdNo));
SQL.Add(' and SOURCETYPE=3 and Accyear=:Accyear and AccMonth=:AccMonth');
Parameters.ParamByName('AccYear').Value:=AccYear;
Parameters.ParamByName('AccMonth').Value:=AccMonth;
ExecSQL;
end;
finally
FreeAndNil(aQuery);
end;
end;
begin
memtblVou.First;
while not memtblVou.Eof do begin
if memtblVou.FieldByName('Selected').AsInteger=1 then
begin
if memTblVou.FieldByName('SOURCETYPE').AsInteger=2 then
deleteStlVt(memTblVou.fieldByName('ordno').AsInteger)
else
if memTblVou.FieldByName('SOURCETYPE').AsInteger=1 then
deleteBusiCardVt(memTblVou.fieldByName('ordno').AsInteger)
else
if memTblVou.FieldByName('SOURCETYPE').AsInteger=4 then
deleteprecost(memTblVou.fieldByName('ordno').AsInteger)
else deleteOpFee(memTblVou.fieldByName('ordno').AsInteger,memTblVou.fieldByName('AccYear').AsInteger,memTblVou.fieldByName('AccMonth').AsInteger) ;
end;
memtblvou.Next;
end;
bsSkinButton8Click(sender);
end;
procedure Tfrm_cw_pingzheng_gj.bsSkinButton21Click(Sender: TObject);
var
str:widestring;
i:integer;
begin
if t_op_seae.IsEmpty then
exit;
if dxDBGrid4.SelectedCount<1 then
begin
showmessage('<27><>ѡ<EFBFBD><D1A1>Ҫ<EFBFBD><D2AA>ӡ<EFBFBD><D3A1>ҵ<EFBFBD>񣡣<EFBFBD>');
exit;
end;
if (t_op_seae.State=dsinsert)or(t_op_seae.State=dsedit) then
t_op_seae.post;
try
frm_ch_piliang_seae:=tfrm_ch_piliang_seae.Create (self);
t_op_seae.DisableControls;
for i:=0 to dxDBGrid4.SelectedCount-1 do
begin
t_op_seae.GotoBookmark(Pointer(dxDBGrid4.selectedrows[I]));
if str='' then
str:=''''+t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString+''''
else
str:=str+','+''''+t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString+'''';
end;
str:='('+str+')';
str:='select * from t_op_seae where <20><><EFBFBD><EFBFBD> in '+str+default_sort(53,'t_op_seae','','desc');
frm_ch_piliang_seae.t_op_seae.Parameters.ParamByName('SQLStr').value:=str;
frm_ch_piliang_seae.t_op_seae.open;
frm_ch_piliang_seae.ShowModal;
finally
t_op_seae.EnableControls;
frm_ch_piliang_seae.Free;
frm_ch_piliang_seae:=nil;
end;
end;
procedure Tfrm_cw_pingzheng_gj.bsSkinButton22Click(Sender: TObject);
var
str:widestring;
i:integer;
begin
if t_op_seai.IsEmpty then
exit;
if dxDBGrid5.SelectedCount<1 then
begin
showmessage('<27><>ѡ<EFBFBD><D1A1>Ҫ<EFBFBD><D2AA>ӡ<EFBFBD><D3A1>ҵ<EFBFBD><D2B5><EFBFBD>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>');
exit;
end;
if (t_op_seai.State=dsinsert)or(t_op_seai.State=dsedit) then
t_op_seai.post;
try
frm_ch_piliang_seai:=tfrm_ch_piliang_seai.Create (self);
t_op_seai.DisableControls;
for i:=0 to dxDBGrid5.SelectedCount-1 do
begin
t_op_seai.GotoBookmark(Pointer(dxDBGrid5.selectedrows[I]));
if str='' then
str:=''''+t_op_seai.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString+''''
else
str:=str+','+''''+t_op_seai.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString+'''';
end;
str:='('+str+')';
str:='select * from t_op_seai where <20><><EFBFBD><EFBFBD> in '+str+default_sort(54,'t_op_seai','','desc');
frm_ch_piliang_seai.t_op_seai.Parameters.ParamByName('SQLStr').value:=str;
frm_ch_piliang_seai.t_op_seai.open;
frm_ch_piliang_seai.ShowModal;
finally
t_op_seai.EnableControls;
frm_ch_piliang_seai.Free;
frm_ch_piliang_seai:=nil;
end;
end;
procedure Tfrm_cw_pingzheng_gj.bsSkinButton23Click(Sender: TObject);
var
str:widestring;
i:integer;
begin
if t_op_aire.IsEmpty then
exit;
if dxDBGrid6.SelectedCount<1 then
begin
showmessage('<27><>ѡ<EFBFBD><D1A1>Ҫ<EFBFBD><D2AA>ӡ<EFBFBD><D3A1>ҵ<EFBFBD><D2B5><EFBFBD>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>');
exit;
end;
if (t_op_aire.State=dsinsert)or(t_op_aire.State=dsedit) then
t_op_aire.post;
try
frm_ch_piliang_aire:=tfrm_ch_piliang_aire.Create (self);
t_op_aire.DisableControls;
for i:=0 to dxDBGrid6.SelectedCount-1 do
begin
t_op_aire.GotoBookmark(Pointer(dxDBGrid6.selectedrows[I]));
if str='' then
str:=''''+t_op_aire.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString+''''
else
str:=str+','+''''+t_op_aire.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString+'''';
end;
str:='('+str+')';
str:='select * from t_op_aire where <20><><EFBFBD><EFBFBD> in '+str+default_sort(55,'t_op_aire','','desc');
frm_ch_piliang_aire.t_op_aire.Parameters.ParamByName('SQLStr').value:=str;
frm_ch_piliang_aire.t_op_aire.open;
frm_ch_piliang_aire.ShowModal;
finally
t_op_aire.EnableControls;
frm_ch_piliang_aire.Free;
frm_ch_piliang_aire:=nil;
end;
end;
procedure Tfrm_cw_pingzheng_gj.bsSkinButton24Click(Sender: TObject);
var
str:widestring;
i:integer;
begin
if t_op_airi.IsEmpty then
exit;
if dxDBGrid7.SelectedCount<1 then
begin
showmessage('<27><>ѡ<EFBFBD><D1A1>Ҫ<EFBFBD><D2AA>ӡ<EFBFBD><D3A1>ҵ<EFBFBD><D2B5><EFBFBD>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>');
exit;
end;
if (t_op_airi.State=dsinsert)or(t_op_airi.State=dsedit) then
t_op_airi.post;
try
frm_ch_piliang_airi:=tfrm_ch_piliang_airi.Create (self);
t_op_airi.DisableControls;
for i:=0 to dxDBGrid7.SelectedCount-1 do
begin
t_op_airi.GotoBookmark(Pointer(dxDBGrid7.selectedrows[I]));
if str='' then
str:=''''+t_op_airi.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString+''''
else
str:=str+','+''''+t_op_airi.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString+'''';
end;
str:='('+str+')';
str:='select * from t_op_airi where <20><><EFBFBD><EFBFBD> in '+str+default_sort(56,'t_op_airi','','desc');
frm_ch_piliang_airi.t_op_airi.Parameters.ParamByName('SQLStr').value:=str;
frm_ch_piliang_airi.t_op_airi.open;
frm_ch_piliang_airi.ShowModal;
finally
t_op_airi.EnableControls;
frm_ch_piliang_airi.Free;
frm_ch_piliang_airi:=nil;
end;
end;
procedure Tfrm_cw_pingzheng_gj.bsSkinButton13Click(Sender: TObject);
var i:integer;
alist:TStringlist;
aAdoQuery:TAdoQuery;
begin
alist:=TStringlist.Create;
alist.Clear;
aAdoQuery:=createadoquery;
with aAdoQuery do
try
i:=0;
memTblVou.First;
while not memtblvou.Eof do
begin
memtblVou.Edit;
memtblVou.FieldByName('Selected').AsInteger:=1;
memtblVou.Post;
alist.Add(memtblVou.FieldByName('ordno').AsString);
i:=i+1;
memtblvou.Next;
end;
if alist.Count>0 then
begin
close;sql.Clear;
sql.Add('select sum(AmtDr) AmtDr,sum(AmtCr) AmtCr');
sql.Add('from vouitems ');
sql.Add('where ordno in ('+alist.CommaText+')');
sql.Add('and ((accid like ''%5101%'') or (accid like ''%5121%''))');
open;first;
showmessage('<27><>ѡ<EFBFBD><D1A1>:'+IntToStr(i)+'<27><>'+#13#10+'<27><><EFBFBD><EFBFBD>:'+FieldByName('AmtCr').AsString+' <20>ɱ<EFBFBD>:'+FieldByName('AmtDr').AsString);
end
finally
alist.Free;
aAdoQuery.Free;
end;
end;
procedure Tfrm_cw_pingzheng_gj.bsSkinButton25Click(Sender: TObject);
begin
memTblVou.First;
while not memtblvou.Eof do begin
memtblVou.Edit;
memtblVou.FieldByName('Selected').AsInteger:=0;
memtblVou.Post;
memtblvou.Next;
end;
end;
procedure Tfrm_cw_pingzheng_gj.Edit12KeyPress(Sender: TObject; var Key: Char);
begin
if not (key in ['0'..'9','.','-']) then key:=#0;
end;
procedure Tfrm_cw_pingzheng_gj.Edit10KeyPress(Sender: TObject; var Key: Char);
begin
if not (key in ['0'..'9','.','-']) then key:=#0;
end;
procedure Tfrm_cw_pingzheng_gj.SQLConnectionAccBeforeConnect(Sender: TObject);
begin
// SQLConnectionAcc.ConnectionString:=connect_string('dsacc.ini');
end;
procedure Tfrm_cw_pingzheng_gj.SQLConnectionAcc2BeforeConnect(
Sender: TObject);
begin
// SQLConnectionAcc2.ConnectionString:=connect_string('dsacc2.ini');
end;
procedure Tfrm_cw_pingzheng_gj.bsSkinButton26Click(Sender: TObject);
var
str:widestring;
begin
str:='where <20>Ƿ<EFBFBD><C7B7>ϳ<EFBFBD>=0 and <20><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD><>'''' and not <20><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD> is null';
if not bsSkinCheckRadioBox8.Checked then
str:=str+' and (<28><><EFBFBD><EFBFBD> is null or <20><><EFBFBD><EFBFBD>=0)';
if Edit24.text<>'' then begin
if Edit26.text<>'' then
str:=str+' and <20><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD>>='+''''+Edit24.text+''''+' and <20><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD><='+''''+Edit26.text+''''
else
str:=str+' and ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD> like '+''''+'%'+Edit24.text+'%'+'''';
end;
if Edit27.text<>'' then begin
if Edit28.text<>'' then
str:=str+' and <20><><EFBFBD><EFBFBD>ƾ֤>='+''''+Edit27.text+''''+' and <20><><EFBFBD><EFBFBD>ƾ֤<='+''''+Edit28.text+''''
else
str:=str+' and <20><><EFBFBD><EFBFBD>ƾ֤ like '+''''+'%'+Edit27.text+'%'+'''';
end;
if Edit25.text<>'' then
str:=str+' and <20><EFBFBD><E1B5A5> like '+''''+'%'+Edit25.text+'%'+'''';
if wwDBDateTimePicker22.text<>''then
str:=str+' and <20><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD>>='+''''+wwDBDateTimePicker22.text+'''';
if wwDBDateTimePicker23.text<>''then
str:=str+' and <20><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD><='+''''+wwDBDateTimePicker23.text+'''';
t_ch_invoice.close;
t_ch_invoice.sql.clear;
t_ch_invoice.sql.add('select * from t_ch_invoice '+str+' order by <20><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD>');
t_ch_invoice.open;
end;
procedure Tfrm_cw_pingzheng_gj.DBGridEh3DrawColumnCell(Sender: TObject;
const Rect: TRect; DataCol: Integer; Column: TColumnEh;
State: TGridDrawState);
begin
with TDBGridEh(Sender), Canvas, Brush do begin
if t_ch_invoice['<27><><EFBFBD><EFBFBD>'] then
Color:=$00FBE8FF;//<2F><><EFBFBD><EFBFBD>
if (gdSelected in State)or(gdFocused in State) then begin
Font.Color:=Color;
Color:=$00C08080;
end;
DefaultDrawColumnCell(Rect, dataCol,Column, State);
end;
end;
procedure Tfrm_cw_pingzheng_gj.bsSkinButton28Click(Sender: TObject);
var
i,ordno:integer;
aQuery,aAdoQuery:TAdoQuery;
s:string;
begin
vat_value:=StrToFloat(Edit43.text);
if wwDBDateTimePicker21.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 RxDBLookupCombo6.DisplayValue='' then begin
MessageDlg('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƶ<EFBFBD><C6B5>ˣ<EFBFBD>',mterror,[mbyes],0);
exit;
end;
dmacc:=TdmAcc.Create(self);
try
aQuery:=CreateAdoQuery;
aAdoQuery:=CreateAdoQuery;
with aAdoQuery do
begin
Close;
SQL.Clear;
SQL.add('select * from t_ch_fee_do where <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>=:<3A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> and <20><><EFBFBD><EFBFBD>=1');
end;
dmAcc.ADOtblVou.Open;
dmAcc.ADOtblVouItems.Open;
aVKNO:=1;
aQuery.Close;
aQuery.SQL.Clear;
aQuery.SQL.add('update t_ch_invoice set <20><><EFBFBD><EFBFBD>=1,<2C><><EFBFBD><EFBFBD>ƾ֤=:<3A><><EFBFBD><EFBFBD>ƾ֤ where <20><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD>=:<3A><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD>');
VoucherDate:=wwDBDateTimePicker21.Date;
if dxDBGrid1.SelectedCount>1 then begin
if not ASSIGNED(frm_sys_progress) then
frm_sys_progress:=tfrm_sys_progress.Create(self);
try
frm_sys_progress.bsSkinGauge1.ProgressText:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƾ֤<C6BE><D6A4><EFBFBD>Ժ󡣡<D4BA><F3A1A3A1><EFBFBD>';
frm_sys_progress.Show;
frm_sys_progress.bsSkinGauge1.MaxValue:=dxDBGrid1.SelectedCount;
frm_sys_progress.bsSkinGauge1.MinValue:=0;
frm_sys_progress.bsSkinGauge1.Value:=0;
frm_sys_progress.Update;
for i:=0 to dxDBGrid1.SelectedCount-1 do begin
t_ch_invoice.GotoBookmark(Pointer(dxDBGrid1.selectedrows[I]));
if t_ch_invoice['<27><><EFBFBD><EFBFBD>'] then begin
MessageDlg('<27><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD>:'+t_ch_invoice['<27><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD>']+'<27>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD><EFBFBD>ƾ֤<C6BE><D6A4><EFBFBD>޷<EFBFBD><DEB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɣ<EFBFBD>',mterror,[mbyes],0);
end
else
begin
aAdoQuery.Close;
aAdoQuery.Parameters.ParamByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').Value:=t_ch_invoice.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString;
aAdoQuery.Open;
if aAdoQuery.IsEmpty then
NewDrCrInv(t_ch_invoice,t_ch_invoice['<27><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD>'],t_ch_invoice.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString,wwDBDateTimePicker21.Date)
else
begin
s:=GetInvoiceNoCorpNo(t_ch_invoice.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString);
if s='' then
InvoiceDr(t_ch_invoice,t_ch_invoice.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString,wwDBDateTimePicker21.Date)
else
begin
showmessage(s+#13#10+'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
end;
end;
if s='' then
begin
aQuery.Parameters.ParamByName('<27><><EFBFBD><EFBFBD>ƾ֤').Value:=dmacc.ADOTblVou.fieldbyname('ordno').AsString;
aQuery.Parameters.ParamByName('<27><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD>').Value:=t_ch_invoice.fieldbyname('<27><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD>').AsString;
aQuery.ExecSQL;
end;
end;
frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1;
end;
finally
freeAndNil(frm_sys_progress);
end;
end
else begin
if t_ch_invoice['<27><><EFBFBD><EFBFBD>'] then begin
MessageDlg('<27><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD>:'+t_ch_invoice['<27><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD>']+'<27>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD><EFBFBD>ƾ֤<C6BE><D6A4><EFBFBD>޷<EFBFBD><DEB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɣ<EFBFBD>',mterror,[mbyes],0);
end else begin
aAdoQuery.Close;
aAdoQuery.Parameters.ParamByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').Value:=t_ch_invoice.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString;
aAdoQuery.Open;
if aAdoQuery.IsEmpty then
NewDrCrInv(t_ch_invoice,t_ch_invoice['<27><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD>'],t_ch_invoice.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString,wwDBDateTimePicker21.Date)
else
begin
s:=GetInvoiceNoCorpNo(t_ch_invoice.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString);
if s='' then
InvoiceDr(t_ch_invoice,t_ch_invoice.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString,wwDBDateTimePicker21.Date)
else
begin
showmessage(s+#13#10+'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
end;
end;
if s='' then
begin
aQuery.Close;
aQuery.Parameters.ParamByName('<27><><EFBFBD><EFBFBD>ƾ֤').Value:=dmacc.ADOTblVou.fieldbyname('ordno').AsString;
aQuery.Parameters.ParamByName('<27><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD>').Value:=t_ch_invoice.fieldbyname('<27><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD>').AsString;
aQuery.ExecSQL;
end;
end;
end;
finally
dmAcc.AdotblVouItems.Close;
dmAcc.AdotblVou.Close;
freeAndNil(dmacc);
aAdoQuery.Free;
aQuery.Free;
end;
bsSkinButton26.OnClick(sender);
end;
procedure Tfrm_cw_pingzheng_gj.bsSkinButton2Click(Sender: TObject);
begin
Kingdee;
end;
procedure Tfrm_cw_pingzheng_gj.bsSkinButton29Click(Sender: TObject);
var
Str:String;
function 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
finally
FreeAndNil(aQuery);
end;
end;
begin
if not bsSkinCheckRadioBox9.checked then
str:=str+' and v.Status=0 ';
if wwDBDateTimePicker24.text<>''then
str:=str+' and v.voudate>='+''''+wwDBDateTimePicker24.text+'''';
if wwDBDateTimePicker25.text<>''then
str:=str+' and v.voudate<='+''''+wwDBDateTimePicker25.text+'''';
if Edit31.text<>''then
str:=str+' and v.ordno>='+''+Edit31.text+'';
if Edit30.text<>''then
str:=str+' and v.ordno<='+''+Edit30.text+'';
if RxDBLookupCombo17.DisplayValue<>''then
str:=str+' and v.prepared='+''''+RxDBLookupCombo17.DisplayValues[0]+'''';
if Edit32.text<>'' then
str:=str+' and v.ACCID='+''''+Edit32.text+'''';
if RxDBLookupCombo18.DisplayValues[1]<>'' then begin
str:=str+' and (v.CorpID='+''''+GetCustID(RxDBLookupCombo18.DisplayValues[1],'<27><>')+''''+' or v.CorpID='+''''+GetCustID(RxDBLookupCombo18.DisplayValues[1],'<27><>')+''''+')';
end;
if trim(Edit33.text)<>'' then
str:=str+' and v.Explan like '+''''+'%'+Edit33.text+'%'+'''';
if Edit29.text<>''then
str:=str+' and v.bsno like '+''''+'%'+Edit29.text+'%'+'''';
with v_vouitems do begin
Close;SQL.Clear;
SQL.Add('Select v.* from v_vouitems V where 1=1 ');
SQL.Add(str);
SQL.Add('Order by V.ORDNO');
Open;
end;
end;
procedure Tfrm_cw_pingzheng_gj.ADOConnection1BeforeConnect(Sender: TObject);
begin
ADOConnection1.ConnectionString:=connect_Odbc('maincw.ini');
end;
procedure Tfrm_cw_pingzheng_gj.DBGridEh1DblClick(Sender: TObject);
begin
fee_view(t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString);
end;
procedure Tfrm_cw_pingzheng_gj.DBGridEh4DblClick(Sender: TObject);
begin
fee_view(t_op_seai.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString);
end;
procedure Tfrm_cw_pingzheng_gj.DBGridEh5DblClick(Sender: TObject);
begin
fee_view(t_op_Aire.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString);
end;
procedure Tfrm_cw_pingzheng_gj.DBGridEh6DblClick(Sender: TObject);
begin
fee_view(t_op_Airi.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString);
end;
procedure Tfrm_cw_pingzheng_gj.qryVouitemsACCIDChange(Sender: TField);
begin
if t_Accitems.Locate('ACCID',Trim(Sender.AsString),[])then
begin
Sender.DataSet.FieldByName('AccName').AsString:=t_Accitems.fieldByName('AccName').AsString;
Sender.DataSet.FieldByName('DC').asString:=t_Accitems.fieldByName('DC').AsString;
Sender.DataSet.FieldByName('FCY').asString:=t_Accitems.fieldByName('FCY').AsString;
Sender.DataSet.FieldByName('DEPTACC').asString:=t_Accitems.fieldByName('DEPTACC').AsString;
Sender.DataSet.FieldByName('EMPLACC').asString:=t_Accitems.fieldByName('EMPLACC').AsString;
Sender.DataSet.FieldByName('CORPACC').asString:=t_Accitems.fieldByName('CORPACC').AsString;
Sender.DataSet.FieldByName('ITEMACC').asString:=t_Accitems.fieldByName('ITEMACC').AsString;
end;
end;
procedure Tfrm_cw_pingzheng_gj.qryVouitemsAfterPost(DataSet: TDataSet);
begin
UpdateVoucherAmt;
qryVouitems_sum.Close;
qryVouitems_sum.sql.Clear;
qryVouitems_sum.SQL.Add('select ordno,sum(AmtDr) AmtDr, sum(AmtCr) AmtCr, sum(FcyDr) FcyDr, sum(FcyCr) FcyCr,sum(FcyDr*FCYEXRATE) FcyDrtoRmb, sum(FcyCr*FCYEXRATE) FcyCrtoRmb');
qryVouitems_sum.SQL.Add('from vouitems');
qryVouitems_sum.SQL.Add('where ordno=:ordno');
qryVouitems_sum.SQL.Add('Group by ordno');
qryVouitems_sum.SQL.Add('order by ordno');
qryVouitems_sum.Open;
end;
procedure Tfrm_cw_pingzheng_gj.qryVouitemsBeforeEdit(DataSet: TDataSet);
begin
if t_cw_design.FieldByName('ƾ֤<C6BE><D6A4>ֹ<EFBFBD>޸<EFBFBD>').AsBoolean then
if qryVouitems.FieldByName('cf').AsInteger=1 then
begin
ShowMessage('ϵͳ<CFB5>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD>ɵķ<C9B5>¼,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>޸<EFBFBD>');
Abort;
end;
end;
procedure Tfrm_cw_pingzheng_gj.qryVouitemsBeforeDelete(DataSet: TDataSet);
begin
if t_cw_design.FieldByName('ƾ֤<C6BE><D6A4>ֹ<EFBFBD>޸<EFBFBD>').AsBoolean then
if qryVouitems.FieldByName('cf').AsInteger=1 then
begin
ShowMessage('ϵͳ<CFB5>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD>ɵķ<C9B5>¼,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>޸<EFBFBD>');
Abort;
end;
end;
procedure Tfrm_cw_pingzheng_gj.bsSkinButton33Click(Sender: TObject);
begin
if qryVouitems=nil then
exit;
if qryVouitems.State in [dsinsert,dsedit] then
qryVouitems.cancel;
end;
procedure Tfrm_cw_pingzheng_gj.bsSkinButton32Click(Sender: TObject);
begin
if qryVouitems=nil then
exit;
if qryVouitems.State in [dsinsert,dsedit] then
qryVouitems.Post;
end;
procedure Tfrm_cw_pingzheng_gj.bsSkinButton31Click(Sender: TObject);
begin
if qryVouitems=nil then
exit;
qryVouitems.Delete;
end;
procedure Tfrm_cw_pingzheng_gj.bsSkinButton30Click(Sender: TObject);
begin
qryVouitems.Append;
end;
procedure Tfrm_cw_pingzheng_gj.bsSkinButton19Click(Sender: TObject);
begin
Edit9.text:='';
RxDBLookupCombo2.Value:='';
Edit2.text:='';
wwDBDateTimePicker17.text:='';
wwDBDateTimePicker18.text:='';
wwDBComboBox1.text:='';
RxDBLookupCombo7.Value:='';
Edit12.text:='';
end;
procedure Tfrm_cw_pingzheng_gj.cxGrid1DBTableView1CustomDrawCell(
Sender: TcxCustomGridTableView; ACanvas: TcxCanvas;
AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
begin
if AViewInfo.GridRecord.Values[3]='TRUE' then
ACanvas.Brush.Color := $00FBE8FF;//<2F><><EFBFBD><EFBFBD>ɫ<EFBFBD>ı<EFBFBD>
end;
procedure Tfrm_cw_pingzheng_gj.bsSkinButton34Click(Sender: TObject);
begin
grid_save_xls(dxdbgrid2);
end;
procedure Tfrm_cw_pingzheng_gj.bsSkinButton35Click(Sender: TObject);
var
str:widestring;
begin
str:='where 1=1 and <20><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD><>'''' and not <20><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD> is null';
if not bsSkinCheckRadioBox10.Checked then
str:=str+' and (<28><><EFBFBD><EFBFBD> is null or <20><><EFBFBD><EFBFBD>=0)';
if Edit36.text<>'' then
begin
if Edit38.text<>'' then
str:=str+' and <20><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD>>='+''''+Edit36.text+''''+' and <20><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD><='+''''+Edit38.text+''''
else
str:=str+' and <20><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD> like '+''''+'%'+Edit36.text+'%'+'''';
end;
if Edit39.text<>'' then
begin
if Edit40.text<>'' then
str:=str+' and <20><><EFBFBD><EFBFBD>ƾ֤>='+''''+Edit39.text+''''+' and <20><><EFBFBD><EFBFBD>ƾ֤<='+''''+Edit40.text+''''
else
str:=str+' and <20><><EFBFBD><EFBFBD>ƾ֤ like '+''''+'%'+Edit39.text+'%'+'''';
end;
if Edit37.text<>'' then
str:=str+' and <20><EFBFBD><E1B5A5> like '+''''+'%'+Edit37.text+'%'+'''';
if wwDBDateTimePicker26.text<>''then
str:=str+' and <20><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD>>='+''''+wwDBDateTimePicker26.text+'''';
if wwDBDateTimePicker27.text<>''then
str:=str+' and <20><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD><='+''''+wwDBDateTimePicker27.text+'''';
t_ch_invoice_hexiao.close;
t_ch_invoice_hexiao.sql.clear;
t_ch_invoice_hexiao.sql.add('select * from t_ch_invoice_hexiao '+str+' order by <20><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD>');
t_ch_invoice_hexiao.open;
end;
procedure Tfrm_cw_pingzheng_gj.bsSkinButton27Click(Sender: TObject);
begin
Edit24.text:='';
Edit25.text:='';
Edit26.text:='';
Edit27.text:='';
Edit28.text:='';
wwDBDateTimePicker22.text:='';
wwDBDateTimePicker23.text:='';
end;
procedure Tfrm_cw_pingzheng_gj.bsSkinButton37Click(Sender: TObject);
begin
Edit36.text:='';
Edit37.text:='';
Edit38.text:='';
Edit39.text:='';
Edit40.text:='';
wwDBDateTimePicker26.text:='';
wwDBDateTimePicker27.text:='';
end;
procedure Tfrm_cw_pingzheng_gj.bsSkinButton36Click(Sender: TObject);
var
i,ordno:integer;
aQuery,aAdoQuery:TAdoQuery;
s:string;
begin
vat_value:=StrToFloat(Edit43.text);
if wwDBDateTimePicker21.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 RxDBLookupCombo6.DisplayValue='' then
begin
MessageDlg('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƶ<EFBFBD><C6B5>ˣ<EFBFBD>',mterror,[mbyes],0);
exit;
end;
dmacc:=TdmAcc.Create(self);
try
aQuery:=CreateAdoQuery;
aAdoQuery:=CreateAdoQuery;
with aAdoQuery do
begin
Close;
SQL.Clear;
SQL.add('select * from t_ch_fee_do where <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>=:<3A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> and <20><><EFBFBD><EFBFBD>=1');
end;
dmAcc.ADOtblVou.Open;
dmAcc.ADOtblVouItems.Open;
aVKNO:=1;
aQuery.Close;
aQuery.SQL.Clear;
aQuery.SQL.add('update t_ch_invoice_hexiao set <20><><EFBFBD><EFBFBD>=1,<2C><><EFBFBD><EFBFBD>ƾ֤=:<3A><><EFBFBD><EFBFBD>ƾ֤ where <20><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD>=:<3A><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD>');
VoucherDate:=wwDBDateTimePicker21.Date;
if dxDBGrid3.SelectedCount>=1 then begin
if not ASSIGNED(frm_sys_progress) then
frm_sys_progress:=tfrm_sys_progress.Create(self);
try
frm_sys_progress.bsSkinGauge1.ProgressText:='<27><><EFBFBD><EFBFBD>У<EFBFBD><D0A3><EFBFBD><EFBFBD><EFBFBD>ݡ<EFBFBD><DDA1><EFBFBD><EFBFBD><EFBFBD>';
frm_sys_progress.Show;
frm_sys_progress.bsSkinGauge1.MaxValue:=dxDBGrid3.SelectedCount;
frm_sys_progress.bsSkinGauge1.MinValue:=0;
frm_sys_progress.bsSkinGauge1.Value:=0;
frm_sys_progress.Update;
for i:=0 to dxDBGrid3.SelectedCount-1 do begin
t_ch_invoice_hexiao.GotoBookmark(Pointer(dxDBGrid3.selectedrows[I]));
if t_ch_invoice_hexiao['<27><><EFBFBD><EFBFBD>'] then begin
MessageDlg('<27><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD>:'+t_ch_invoice['<27><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD>']+'<27>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD><EFBFBD>ƾ֤<C6BE><D6A4><EFBFBD>޷<EFBFBD><DEB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɣ<EFBFBD>',mterror,[mbyes],0);
Exit;
end
else
begin
s:=GetInvoiceNoCorpNo(t_ch_invoice_hexiao.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString);
if s='' then
else
begin
showmessage(s+#13#10+'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
Exit;
end;
end;
frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1;
end;
finally
freeAndNil(frm_sys_progress);
end;
end;
if dxDBGrid3.SelectedCount>=1 then begin
if not ASSIGNED(frm_sys_progress) then
frm_sys_progress:=tfrm_sys_progress.Create(self);
try
frm_sys_progress.bsSkinGauge1.ProgressText:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƾ֤<C6BE><D6A4><EFBFBD>Ժ󡣡<D4BA><F3A1A3A1><EFBFBD>';
frm_sys_progress.Show;
frm_sys_progress.bsSkinGauge1.MaxValue:=dxDBGrid3.SelectedCount;
frm_sys_progress.bsSkinGauge1.MinValue:=0;
frm_sys_progress.bsSkinGauge1.Value:=0;
frm_sys_progress.Update;
dmAcc.AdotblVou.Insert;
dmAcc.AdotblVou.FieldByName('SourceType').AsInteger:=1;
dmAcc.AdotblVou.FieldByName('ATTACHS').AsInteger:=AccInfo.ATTACHS;
if Trim(AccInfo.TransName)<>'' then
dmAcc.AdotblVou.FieldByName('VKNO').AsString:=AccInfo.TransName
else dmAcc.AdotblVou.FieldByName('VKNO').AsString:='<27><>';
dmAcc.AdotblVou.FieldByName('PREPARED').AsString:=RxDBLookupCombo6.DisplayValues[0];
dmAcc.AdotblVou.Post;
dmAcc.AdotblVou.Edit;
{
dmAcc.AdotblVou.Insert;
dmAcc.AdotblVou.FieldByName('SourceType').AsInteger:=1;
dmAcc.AdotblVou.FieldByName('ATTACHS').AsInteger:=AccInfo.ATTACHS;
if Trim(AccInfo.TransName)<>'' then
dmAcc.AdotblVou.FieldByName('VKNO').AsString:=AccInfo.TransName
else dmAcc.AdotblVou.FieldByName('VKNO').AsString:='<27><>';
dmAcc.AdotblVou.FieldByName('PREPARED').AsString:=RxDBLookupCombo6.DisplayValues[0];
dmAcc.AdotblVou.Post;
dmAcc.AdotblVou.Edit;
}
for i:=0 to dxDBGrid3.SelectedCount-1 do begin
t_ch_invoice_hexiao.GotoBookmark(Pointer(dxDBGrid3.selectedrows[I]));
if t_ch_invoice_hexiao['<27><><EFBFBD><EFBFBD>'] then begin
MessageDlg('<27><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD>:'+t_ch_invoice['<27><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD>']+'<27>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD><EFBFBD>ƾ֤<C6BE><D6A4><EFBFBD>޷<EFBFBD><DEB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɣ<EFBFBD>',mterror,[mbyes],0);
end else begin
aAdoQuery.Close;
aAdoQuery.Parameters.ParamByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').Value:=t_ch_invoice_hexiao.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString;
aAdoQuery.Open;
if aAdoQuery.IsEmpty then
NewDrCrInvCr(t_ch_invoice_hexiao,t_ch_invoice_hexiao['<27><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD>'],t_ch_invoice_hexiao.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString,wwDBDateTimePicker21.Date)
else
begin
s:=GetInvoiceNoCorpNo(t_ch_invoice_hexiao.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString);
if s='' then
InvoiceCr(t_ch_invoice_hexiao,t_ch_invoice_hexiao.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString,wwDBDateTimePicker21.Date)
else
begin
showmessage(s+#13#10+'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
end;
end;
if s='' then
begin
aQuery.Parameters.ParamByName('<27><><EFBFBD><EFBFBD>ƾ֤').Value:=dmacc.ADOTblVou.fieldbyname('ordno').AsString;
aQuery.Parameters.ParamByName('<27><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD>').Value:=t_ch_invoice_hexiao.fieldbyname('<27><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD>').AsString;
aQuery.ExecSQL;
end;
end;
frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1;
end;
finally
freeAndNil(frm_sys_progress);
end;
end;
{
else
begin
if t_ch_invoice_hexiao['<27><><EFBFBD><EFBFBD>'] then begin
MessageDlg('<27><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD>:'+t_ch_invoice_hexiao['<27><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD>']+'<27>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD><EFBFBD>ƾ֤<C6BE><D6A4><EFBFBD>޷<EFBFBD><DEB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɣ<EFBFBD>',mterror,[mbyes],0);
end else begin
aAdoQuery.Close;
aAdoQuery.Parameters.ParamByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').Value:=t_ch_invoice_hexiao.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString;
aAdoQuery.Open;
if aAdoQuery.IsEmpty then
NewDrCrInvCr(t_ch_invoice_hexiao,t_ch_invoice_hexiao['<27><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD>'],t_ch_invoice_hexiao.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString,wwDBDateTimePicker21.Date)
else
begin
s:=GetInvoiceNoCorpNo(t_ch_invoice_hexiao.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString);
if s='' then
InvoiceCr(t_ch_invoice_hexiao,t_ch_invoice_hexiao.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString,wwDBDateTimePicker21.Date)
else
begin
showmessage(s+#13#10+'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
end;
end;
if s='' then
begin
aQuery.Close;
aQuery.Parameters.ParamByName('<27><><EFBFBD><EFBFBD>ƾ֤').Value:=dmacc.ADOTblVou.fieldbyname('ordno').AsString;
aQuery.Parameters.ParamByName('<27><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD>').Value:=t_ch_invoice_hexiao.fieldbyname('<27><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD>').AsString;
aQuery.ExecSQL;
end;
end;
end;
}
finally
dmAcc.AdotblVouItems.Close;
dmAcc.AdotblVou.Close;
freeAndNil(dmacc);
end;
bsSkinButton35.OnClick(sender);
end;
procedure Tfrm_cw_pingzheng_gj.dxDBGrid4DblClick(Sender: TObject);
begin
fee_view(t_op_seae1.DataSet.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring);
end;
procedure Tfrm_cw_pingzheng_gj.dxDBGrid6DblClick(Sender: TObject);
begin
fee_view(t_op_Aire1.DataSet.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring);
end;
procedure Tfrm_cw_pingzheng_gj.dxDBGrid4CustomDraw(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[dxDBGrid4Column3.Index])='TRUE' then
begin
AColor:=clFuchsia;
exit;
end;
end;
procedure Tfrm_cw_pingzheng_gj.dxDBGrid2CustomDraw(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[dxDBGridCheckColumn2.Index])='TRUE' then
begin
AColor:=clFuchsia;
exit;
end;
end;
procedure Tfrm_cw_pingzheng_gj.dxDBGrid1CustomDraw(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[dxDBGrid1Column1.Index])='TRUE' then
begin
AColor:=clFuchsia;
exit;
end;
end;
procedure Tfrm_cw_pingzheng_gj.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[dxDBGrid1Column1.Index])='TRUE' then
begin
AColor:=clFuchsia;
exit;
end;
end;
procedure Tfrm_cw_pingzheng_gj.dxDBGrid5CustomDraw(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[dxDBGridColumn18.Index])='TRUE' then
begin
AColor:=clFuchsia;
exit;
end;
end;
end.