{$INCLUDE t_main.inc} unit u_ch_invoice; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, ComCtrls, bsSkinTabs, bsSkinCtrls, DB, ADODB, dxExEdtr,CommCtrl, dxCntner, dxTL, dxDBCtrl, dxDBGrid, dxDBTLCl, dxGrClms, wwdblook, StdCtrls, DBCtrls, RxLookup, bsdbctrls, Mask, wwdbdatetimepicker, ExtCtrls, Menus, XPMenu, u_ch_add_do, u_ch_delete_do, wwdbedit, Wwdotdot, Wwdbcomb, DBCtrlsEh, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData, cxDataStorage, cxEdit, cxDBData, cxCurrencyEdit, cxNavigator, cxDBNavigator, cxGridLevel, cxGridCustomTableView, cxGridTableView, cxGridDBTableView, cxClasses, cxControls, cxGridCustomView, cxGrid,inifiles; type Tfrm_ch_invoice = class(TForm) bsSkinPageControl1: TbsSkinPageControl; bsSkinTabSheet1: TbsSkinTabSheet; bsSkinTabSheet2: TbsSkinTabSheet; bsSkinTabSheet3: TbsSkinTabSheet; bsSkinPanel2: TbsSkinPanel; bsSkinButton5: TbsSkinButton; bsSkinButton9: TbsSkinButton; bsSkinButton10: TbsSkinButton; bsSkinButton3: TbsSkinButton; bsSkinButton1: TbsSkinButton; t_ch_invoice_shen: TADOQuery; t_ch_invoice_shen1: TDataSource; v_fee_do_seae: TADOQuery; v_fee_do_seae1: TDataSource; t_ch_invoice: TADOQuery; t_ch_invoice1: TDataSource; bsSkinButton2: TbsSkinButton; bsSkinButton6: TbsSkinButton; bsSkinButton7: TbsSkinButton; bsSkinButton8: TbsSkinButton; bsSkinPanel1: TbsSkinPanel; bsSkinButton4: TbsSkinButton; bsSkinButton11: TbsSkinButton; bsSkinButton12: TbsSkinButton; bsSkinButton13: TbsSkinButton; bsSkinButton14: TbsSkinButton; bsSkinButton16: TbsSkinButton; bsSkinButton17: TbsSkinButton; bsSkinButton18: TbsSkinButton; bsSkinButton19: TbsSkinButton; bsSkinButton15: TbsSkinButton; bsSkinButton20: TbsSkinButton; bsSkinPanel3: TbsSkinPanel; bsSkinButton21: TbsSkinButton; bsSkinButton23: TbsSkinButton; bsSkinButton24: TbsSkinButton; bsSkinButton25: TbsSkinButton; bsSkinButton26: TbsSkinButton; bsSkinButton30: TbsSkinButton; bsSkinPageControl2: TbsSkinPageControl; bsSkinTabSheet11: TbsSkinTabSheet; bsSkinTabSheet22: TbsSkinTabSheet; dxDBGrid2: TdxDBGrid; dxDBGridMaskColumn1: TdxDBGridMaskColumn; dxDBGridMaskColumn2: TdxDBGridMaskColumn; dxDBGridMaskColumn3: TdxDBGridMaskColumn; dxDBGridMaskColumn4: TdxDBGridMaskColumn; dxDBGridMaskColumn5: TdxDBGridMaskColumn; dxDBGridMaskColumn6: TdxDBGridMaskColumn; dxDBGridMaskColumn7: TdxDBGridMaskColumn; dxDBGridDateColumn1: TdxDBGridDateColumn; dxDBGridMaskColumn8: TdxDBGridMaskColumn; dxDBGridMaskColumn9: TdxDBGridMaskColumn; dxDBGridMaskColumn10: TdxDBGridMaskColumn; dxDBGridMaskColumn11: TdxDBGridMaskColumn; dxDBGridMaskColumn12: TdxDBGridMaskColumn; dxDBGridColumn1: TdxDBGridColumn; dxDBGridColumn2: TdxDBGridColumn; dxDBGridColumn3: TdxDBGridColumn; dxDBGridColumn4: TdxDBGridColumn; dxDBGrid1Column18: TdxDBGridMaskColumn; dxDBGridMaskColumn13: TdxDBGridMaskColumn; dxDBGridDateColumn2: TdxDBGridDateColumn; dxDBGridMaskColumn14: TdxDBGridMaskColumn; dxDBGridDateColumn3: TdxDBGridDateColumn; dxDBGridMaskColumn15: TdxDBGridMaskColumn; dxDBGridDateColumn4: TdxDBGridDateColumn; bsSkinButton28: TbsSkinButton; bsSkinButton29: TbsSkinButton; bsSkinPageControl3: TbsSkinPageControl; bsSkinTabSheet4: TbsSkinTabSheet; dxDBGrid3: TdxDBGrid; dxDBGridMaskColumn16: TdxDBGridMaskColumn; dxDBGridMaskColumn17: TdxDBGridMaskColumn; dxDBGridMaskColumn18: TdxDBGridMaskColumn; dxDBGridMaskColumn19: TdxDBGridMaskColumn; dxDBGridMaskColumn20: TdxDBGridMaskColumn; dxDBGridColumn5: TdxDBGridColumn; dxDBGridColumn6: TdxDBGridColumn; dxDBGridMaskColumn21: TdxDBGridMaskColumn; dxDBGridDateColumn5: TdxDBGridDateColumn; dxDBGridDateColumn6: TdxDBGridDateColumn; dxDBGridMaskColumn22: TdxDBGridMaskColumn; dxDBGridMaskColumn23: TdxDBGridMaskColumn; dxDBGridMaskColumn24: TdxDBGridMaskColumn; dxDBGridMaskColumn25: TdxDBGridMaskColumn; dxDBGridMaskColumn26: TdxDBGridMaskColumn; dxDBGridColumn7: TdxDBGridColumn; dxDBGridColumn8: TdxDBGridColumn; dxDBGridMaskColumn27: TdxDBGridMaskColumn; dxDBGridMaskColumn28: TdxDBGridMaskColumn; dxDBGridMaskColumn29: TdxDBGridMaskColumn; dxDBGridMaskColumn30: TdxDBGridMaskColumn; bsSkinTabSheet5: TbsSkinTabSheet; bsSkinTabSheet6: TbsSkinTabSheet; bsSkinTabSheet7: TbsSkinTabSheet; bsSkinPanel7: TbsSkinPanel; Label54: TLabel; DBEdit16: TDBEdit; Label21: TLabel; DBEdit12: TDBEdit; Label57: TLabel; DBEdit17: TDBEdit; Label59: TLabel; DBEdit18: TDBEdit; Label63: TLabel; RxDBLookupCombo3: TRxDBLookupCombo; PopupMenu2: TPopupMenu; N1: TMenuItem; N2: TMenuItem; N20: TMenuItem; bsSkinButton31: TbsSkinButton; XPMenu1: TXPMenu; v_fee_do_seai: TADOQuery; v_fee_do_seai1: TDataSource; dxDBGrid4: TdxDBGrid; dxDBGridMaskColumn31: TdxDBGridMaskColumn; dxDBGridMaskColumn32: TdxDBGridMaskColumn; dxDBGridMaskColumn33: TdxDBGridMaskColumn; dxDBGridMaskColumn34: TdxDBGridMaskColumn; dxDBGridMaskColumn35: TdxDBGridMaskColumn; dxDBGridColumn9: TdxDBGridColumn; dxDBGridColumn10: TdxDBGridColumn; dxDBGridMaskColumn36: TdxDBGridMaskColumn; dxDBGridDateColumn7: TdxDBGridDateColumn; dxDBGridDateColumn8: TdxDBGridDateColumn; dxDBGridMaskColumn37: TdxDBGridMaskColumn; dxDBGridMaskColumn38: TdxDBGridMaskColumn; dxDBGridMaskColumn39: TdxDBGridMaskColumn; dxDBGridMaskColumn40: TdxDBGridMaskColumn; dxDBGridMaskColumn41: TdxDBGridMaskColumn; dxDBGridColumn11: TdxDBGridColumn; dxDBGridColumn12: TdxDBGridColumn; dxDBGridMaskColumn42: TdxDBGridMaskColumn; dxDBGridMaskColumn43: TdxDBGridMaskColumn; dxDBGridMaskColumn44: TdxDBGridMaskColumn; dxDBGridMaskColumn45: TdxDBGridMaskColumn; N3: TMenuItem; N4: TMenuItem; v_fee_do_aire: TADOQuery; v_fee_do_aire1: TDataSource; v_fee_do_airi: TADOQuery; v_fee_do_airi1: TDataSource; dxDBGrid5: TdxDBGrid; dxDBGridMaskColumn46: TdxDBGridMaskColumn; dxDBGridMaskColumn47: TdxDBGridMaskColumn; dxDBGridMaskColumn48: TdxDBGridMaskColumn; dxDBGridMaskColumn49: TdxDBGridMaskColumn; dxDBGridMaskColumn50: TdxDBGridMaskColumn; dxDBGridColumn13: TdxDBGridColumn; dxDBGridColumn14: TdxDBGridColumn; dxDBGridMaskColumn51: TdxDBGridMaskColumn; dxDBGridDateColumn9: TdxDBGridDateColumn; dxDBGridDateColumn10: TdxDBGridDateColumn; dxDBGridMaskColumn52: TdxDBGridMaskColumn; dxDBGridMaskColumn53: TdxDBGridMaskColumn; dxDBGridMaskColumn54: TdxDBGridMaskColumn; dxDBGridColumn15: TdxDBGridColumn; dxDBGridColumn16: TdxDBGridColumn; dxDBGridMaskColumn55: TdxDBGridMaskColumn; dxDBGridMaskColumn56: TdxDBGridMaskColumn; dxDBGridMaskColumn57: TdxDBGridMaskColumn; dxDBGrid6: TdxDBGrid; dxDBGridMaskColumn58: TdxDBGridMaskColumn; dxDBGridMaskColumn59: TdxDBGridMaskColumn; dxDBGridMaskColumn60: TdxDBGridMaskColumn; dxDBGridMaskColumn61: TdxDBGridMaskColumn; dxDBGridMaskColumn62: TdxDBGridMaskColumn; dxDBGridColumn17: TdxDBGridColumn; dxDBGridColumn18: TdxDBGridColumn; dxDBGridMaskColumn63: TdxDBGridMaskColumn; dxDBGridDateColumn11: TdxDBGridDateColumn; dxDBGridDateColumn12: TdxDBGridDateColumn; dxDBGridMaskColumn64: TdxDBGridMaskColumn; dxDBGridMaskColumn65: TdxDBGridMaskColumn; dxDBGridMaskColumn66: TdxDBGridMaskColumn; dxDBGridColumn19: TdxDBGridColumn; dxDBGridColumn20: TdxDBGridColumn; dxDBGridMaskColumn67: TdxDBGridMaskColumn; dxDBGridMaskColumn68: TdxDBGridMaskColumn; dxDBGridMaskColumn69: TdxDBGridMaskColumn; PopupMenu1: TPopupMenu; N10: TMenuItem; N11: TMenuItem; N14: TMenuItem; N13: TMenuItem; N12: TMenuItem; N15: TMenuItem; N16: TMenuItem; bsSkinButton22: TbsSkinButton; bsSkinButton27: TbsSkinButton; bsSkinButton32: TbsSkinButton; ADOQuery1: TADOQuery; DataSource1: TDataSource; ADOQuery2: TADOQuery; DataSource2: TDataSource; ADOQuery3: TADOQuery; DataSource3: TDataSource; ADOQuery4: TADOQuery; DataSource4: TDataSource; PopupMenu3: TPopupMenu; N17: TMenuItem; N18: TMenuItem; N34: TMenuItem; N35: TMenuItem; N36: TMenuItem; MenuItem1: TMenuItem; N6: TMenuItem; N5: TMenuItem; MenuItem2: TMenuItem; bsSkinPanel4: TbsSkinPanel; Label1: TLabel; Label4: TLabel; Label7: TLabel; Label13: TLabel; Label2: TLabel; Label5: TLabel; Label8: TLabel; Label14: TLabel; Label9: TLabel; Label3: TLabel; Label6: TLabel; Label10: TLabel; Label11: TLabel; Label16: TLabel; Label15: TLabel; bsSkinPanel5: TbsSkinPanel; Label25: TLabel; Label17: TLabel; Label18: TLabel; Label20: TLabel; Label19: TLabel; Label12: TLabel; Label64: TLabel; Label65: TLabel; DBEdit14: TDBEdit; DBEdit1: TDBEdit; DBEdit5: TDBEdit; DBEdit7: TDBEdit; DBEdit8: TDBEdit; DBEdit2: TDBEdit; DBEdit3: TDBEdit; DBEdit4: TDBEdit; DBMemo1: TDBMemo; DBEdit6: TDBEdit; DBEdit9: TDBEdit; DBMemo2: TDBMemo; DBEdit10: TDBEdit; DBEdit11: TDBEdit; DBEdit20: TDBEdit; DBEdit21: TDBEdit; DBMemo3: TDBMemo; DBEdit22: TDBEdit; DBEdit23: TDBEdit; DBEdit24: TDBEdit; DBEdit25: TDBEdit; DBEdit26: TDBEdit; DBEdit28: TDBEdit; dxDBGrid2Column25: TdxDBGridColumn; dxDBGrid2Column26: TdxDBGridColumn; dxDBGrid3Column22: TdxDBGridColumn; dxDBGrid4Column22: TdxDBGridColumn; dxDBGrid5Column19: TdxDBGridColumn; dxDBGrid6Column19: TdxDBGridColumn; t_ch_invoice_head: TADOQuery; t_ch_invoice_head1: TDataSource; dxDBGrid3Column23: TdxDBGridColumn; dxDBGrid6Column20: TdxDBGridColumn; dxDBGrid5Column20: TdxDBGridColumn; dxDBGrid4Column23: TdxDBGridColumn; N7: TMenuItem; N8: TMenuItem; N9: TMenuItem; N19: TMenuItem; bsSkinNotebook1: TbsSkinNotebook; dxDBGrid1: TdxDBGrid; dxDBGrid1Column1: TdxDBGridMaskColumn; dxDBGrid1Column38: TdxDBGridCheckColumn; dxDBGrid1Column2: TdxDBGridMaskColumn; dxDBGrid1Column3: TdxDBGridMaskColumn; dxDBGrid1Column4: TdxDBGridMaskColumn; dxDBGrid1Column5: TdxDBGridDateColumn; dxDBGrid1Column6: TdxDBGridMaskColumn; dxDBGrid1Column7: TdxDBGridMaskColumn; dxDBGrid1Column8: TdxDBGridMaskColumn; dxDBGrid1Column9: TdxDBGridMaskColumn; dxDBGrid1Column10: TdxDBGridDateColumn; dxDBGrid1Column11: TdxDBGridMaskColumn; dxDBGrid1Column12: TdxDBGridMaskColumn; dxDBGrid1Column13: TdxDBGridMaskColumn; dxDBGrid1Column14: TdxDBGridMaskColumn; dxDBGrid1Column15: TdxDBGridMaskColumn; dxDBGrid1Column16: TdxDBGridMaskColumn; dxDBGrid1Column17: TdxDBGridMaskColumn; dxDBGrid1Column37: TdxDBGridColumn; dxDBGrid1Column19: TdxDBGridColumn; dxDBGrid1Column20: TdxDBGridColumn; dxDBGrid1Column21: TdxDBGridColumn; dxDBGrid1Column22: TdxDBGridMaskColumn; dxDBGrid1Column23: TdxDBGridMaskColumn; dxDBGrid1Column24: TdxDBGridMaskColumn; dxDBGrid1Column25: TdxDBGridCheckColumn; dxDBGrid1Column26: TdxDBGridMaskColumn; dxDBGrid1Column27: TdxDBGridDateColumn; dxDBGrid1Column28: TdxDBGridMaskColumn; dxDBGrid1Column32: TdxDBGridCheckColumn; dxDBGrid1Column29: TdxDBGridCheckColumn; dxDBGrid1Column30: TdxDBGridMaskColumn; dxDBGrid1Column35: TdxDBGridMaskColumn; dxDBGrid1Column36: TdxDBGridDateColumn; dxDBGrid1Column31: TdxDBGridMaskColumn; dxDBGrid1Column33: TdxDBGridMaskColumn; dxDBGrid1Column34: TdxDBGridDateColumn; bsSkinPageControl4: TbsSkinPageControl; pagesheet2: TbsSkinTabSheet; bsSkinPageControl5: TbsSkinPageControl; bsSkinTabSheet8: TbsSkinTabSheet; dxDBGrid7: TdxDBGrid; dxDBGridMaskColumn70: TdxDBGridMaskColumn; dxDBGridMaskColumn71: TdxDBGridMaskColumn; dxDBGridMaskColumn72: TdxDBGridMaskColumn; dxDBGridMaskColumn73: TdxDBGridMaskColumn; dxDBGridMaskColumn74: TdxDBGridMaskColumn; dxDBGridColumn21: TdxDBGridColumn; dxDBGrid7Column23: TdxDBGridColumn; dxDBGridColumn22: TdxDBGridColumn; dxDBGridMaskColumn75: TdxDBGridMaskColumn; dxDBGrid7Column22: TdxDBGridColumn; dxDBGridDateColumn13: TdxDBGridDateColumn; dxDBGridDateColumn14: TdxDBGridDateColumn; dxDBGridMaskColumn76: TdxDBGridMaskColumn; dxDBGridMaskColumn77: TdxDBGridMaskColumn; dxDBGridMaskColumn78: TdxDBGridMaskColumn; dxDBGridMaskColumn79: TdxDBGridMaskColumn; dxDBGridMaskColumn80: TdxDBGridMaskColumn; dxDBGridColumn23: TdxDBGridColumn; dxDBGridColumn24: TdxDBGridColumn; dxDBGridMaskColumn81: TdxDBGridMaskColumn; dxDBGridMaskColumn82: TdxDBGridMaskColumn; dxDBGridMaskColumn83: TdxDBGridMaskColumn; dxDBGridMaskColumn84: TdxDBGridMaskColumn; bsSkinTabSheet9: TbsSkinTabSheet; dxDBGrid8: TdxDBGrid; dxDBGridMaskColumn85: TdxDBGridMaskColumn; dxDBGridMaskColumn86: TdxDBGridMaskColumn; dxDBGridMaskColumn87: TdxDBGridMaskColumn; dxDBGridMaskColumn88: TdxDBGridMaskColumn; dxDBGridMaskColumn89: TdxDBGridMaskColumn; dxDBGridColumn25: TdxDBGridColumn; dxDBGrid8Column23: TdxDBGridColumn; dxDBGridColumn26: TdxDBGridColumn; dxDBGridMaskColumn90: TdxDBGridMaskColumn; dxDBGrid8Column22: TdxDBGridColumn; dxDBGridDateColumn15: TdxDBGridDateColumn; dxDBGridDateColumn16: TdxDBGridDateColumn; dxDBGridMaskColumn91: TdxDBGridMaskColumn; dxDBGridMaskColumn92: TdxDBGridMaskColumn; dxDBGridMaskColumn93: TdxDBGridMaskColumn; dxDBGridMaskColumn94: TdxDBGridMaskColumn; dxDBGridMaskColumn95: TdxDBGridMaskColumn; dxDBGridColumn27: TdxDBGridColumn; dxDBGridColumn28: TdxDBGridColumn; dxDBGridMaskColumn96: TdxDBGridMaskColumn; dxDBGridMaskColumn97: TdxDBGridMaskColumn; dxDBGridMaskColumn98: TdxDBGridMaskColumn; dxDBGridMaskColumn99: TdxDBGridMaskColumn; bsSkinTabSheet10: TbsSkinTabSheet; dxDBGrid9: TdxDBGrid; dxDBGridMaskColumn100: TdxDBGridMaskColumn; dxDBGridMaskColumn101: TdxDBGridMaskColumn; dxDBGridMaskColumn102: TdxDBGridMaskColumn; dxDBGridMaskColumn103: TdxDBGridMaskColumn; dxDBGridMaskColumn104: TdxDBGridMaskColumn; dxDBGridColumn29: TdxDBGridColumn; dxDBGrid9Column20: TdxDBGridColumn; dxDBGridColumn30: TdxDBGridColumn; dxDBGridMaskColumn105: TdxDBGridMaskColumn; dxDBGrid9Column19: TdxDBGridColumn; dxDBGridDateColumn17: TdxDBGridDateColumn; dxDBGridDateColumn18: TdxDBGridDateColumn; dxDBGridMaskColumn106: TdxDBGridMaskColumn; dxDBGridMaskColumn107: TdxDBGridMaskColumn; dxDBGridMaskColumn108: TdxDBGridMaskColumn; dxDBGridColumn31: TdxDBGridColumn; dxDBGridColumn32: TdxDBGridColumn; dxDBGridMaskColumn109: TdxDBGridMaskColumn; dxDBGridMaskColumn110: TdxDBGridMaskColumn; dxDBGridMaskColumn111: TdxDBGridMaskColumn; bsSkinTabSheet12: TbsSkinTabSheet; dxDBGrid10: TdxDBGrid; dxDBGridMaskColumn112: TdxDBGridMaskColumn; dxDBGridMaskColumn113: TdxDBGridMaskColumn; dxDBGridMaskColumn114: TdxDBGridMaskColumn; dxDBGridMaskColumn115: TdxDBGridMaskColumn; dxDBGridMaskColumn116: TdxDBGridMaskColumn; dxDBGridColumn33: TdxDBGridColumn; dxDBGrid10Column20: TdxDBGridColumn; dxDBGridColumn34: TdxDBGridColumn; dxDBGridMaskColumn117: TdxDBGridMaskColumn; dxDBGrid10Column19: TdxDBGridColumn; dxDBGridDateColumn19: TdxDBGridDateColumn; dxDBGridDateColumn20: TdxDBGridDateColumn; dxDBGridMaskColumn118: TdxDBGridMaskColumn; dxDBGridMaskColumn119: TdxDBGridMaskColumn; dxDBGridMaskColumn120: TdxDBGridMaskColumn; dxDBGridColumn35: TdxDBGridColumn; dxDBGridColumn36: TdxDBGridColumn; dxDBGridMaskColumn121: TdxDBGridMaskColumn; dxDBGridMaskColumn122: TdxDBGridMaskColumn; dxDBGridMaskColumn123: TdxDBGridMaskColumn; bsSkinPageControl6: TbsSkinPageControl; bstab1: TbsSkinTabSheet; bstab2: TbsSkinTabSheet; s_invoice: TScrollBox; Label27: TLabel; Label29: TLabel; Label31: TLabel; Label33: TLabel; Label35: TLabel; Label41: TLabel; Shape10: TShape; Shape14: TShape; Label46: TLabel; Label47: TLabel; Label48: TLabel; Label49: TLabel; Label50: TLabel; Label52: TLabel; Label53: TLabel; Label55: TLabel; Label56: TLabel; Label58: TLabel; Label60: TLabel; Label61: TLabel; Label62: TLabel; Label24: TLabel; Label26: TLabel; Label66: TLabel; wwDBDateTimePicker1: TwwDBDateTimePicker; DE_ShipName: TDBEdit; DE_BLNO: TDBEdit; wwDBDateTimePicker2: TwwDBDateTimePicker; DM: TDBMemo; DE_SumUpper: TDBEdit; DBSumLower: TDBEdit; DE_BusnessNo: TDBEdit; DE_TaxNo: TDBEdit; DE_Maker: TDBEdit; wwDBDateTimePicker3: TwwDBDateTimePicker; wwDBLookupCombo6: TwwDBLookupCombo; wwDBLookupCombo7: TwwDBLookupCombo; DBCheckBox3: TDBCheckBox; wwDBLookupCombo12: TwwDBLookupCombo; RxDBLookupCombo2: TRxDBLookupCombo; DBEdit27: TDBEdit; bsSkinPanel6: TbsSkinPanel; Label22: TLabel; Label23: TLabel; DBEdit13: TDBEdit; DBEdit15: TDBEdit; bsSkinDBCheckRadioBox2: TbsSkinDBCheckRadioBox; bsSkinDBCheckRadioBox3: TbsSkinDBCheckRadioBox; DBEdit29: TDBEdit; wwDBLookupCombo1: TwwDBLookupCombo; Panel1: TPanel; fra_ch_delete_do1: Tfra_ch_delete_do; fra_ch_add_do1: Tfra_ch_add_do; ComboBoxObjBsCard: TDBComboBox; dxDBGrid1Column39: TdxDBGridColumn; dbedt1: TDBEdit; DBEdit19: TDBEdit; DBEdit30: TDBEdit; t_sys_bank: TADOQuery; t_sys_bank1: TDataSource; bsSkinButton38: TbsSkinButton; bsSkinButton33: TbsSkinButton; DBComboBoxEh1: TDBComboBoxEh; dxDBGrid3Column24: TdxDBGridColumn; dxDBGrid3Column25: TdxDBGridColumn; dxDBGrid4Column24: TdxDBGridColumn; dxDBGrid4Column25: TdxDBGridColumn; dxDBGrid5Column21: TdxDBGridColumn; dxDBGrid5Column22: TdxDBGridColumn; dxDBGrid6Column21: TdxDBGridColumn; dxDBGrid6Column22: TdxDBGridColumn; dxDBGrid7Column24: TdxDBGridColumn; dxDBGrid7Column25: TdxDBGridColumn; dxDBGrid8Column24: TdxDBGridColumn; dxDBGrid8Column25: TdxDBGridColumn; bsSkinButton34: TbsSkinButton; bsSkinButton35: TbsSkinButton; v_fee_do_bscard: TADOQuery; v_fee_do_bscard1: TDataSource; bsSkinTabSheet13: TbsSkinTabSheet; dxDBGrid11: TdxDBGrid; dxDBGridMaskColumn124: TdxDBGridMaskColumn; dxDBGridMaskColumn125: TdxDBGridMaskColumn; dxDBGridMaskColumn126: TdxDBGridMaskColumn; dxDBGridMaskColumn127: TdxDBGridMaskColumn; dxDBGridMaskColumn128: TdxDBGridMaskColumn; dxDBGridColumn37: TdxDBGridColumn; dxDBGridColumn38: TdxDBGridColumn; dxDBGridColumn39: TdxDBGridColumn; dxDBGridMaskColumn129: TdxDBGridMaskColumn; dxDBGridColumn40: TdxDBGridColumn; dxDBGridDateColumn21: TdxDBGridDateColumn; dxDBGridDateColumn22: TdxDBGridDateColumn; dxDBGridMaskColumn130: TdxDBGridMaskColumn; dxDBGridMaskColumn131: TdxDBGridMaskColumn; dxDBGridMaskColumn132: TdxDBGridMaskColumn; dxDBGridMaskColumn133: TdxDBGridMaskColumn; dxDBGridMaskColumn134: TdxDBGridMaskColumn; dxDBGridColumn41: TdxDBGridColumn; dxDBGridColumn42: TdxDBGridColumn; dxDBGridMaskColumn135: TdxDBGridMaskColumn; dxDBGridMaskColumn136: TdxDBGridMaskColumn; dxDBGridMaskColumn137: TdxDBGridMaskColumn; dxDBGridMaskColumn138: TdxDBGridMaskColumn; dxDBGridColumn43: TdxDBGridColumn; dxDBGridColumn44: TdxDBGridColumn; dxDBGrid11Column26: TdxDBGridColumn; bsSkinTabSheet14: TbsSkinTabSheet; dxDBGrid12: TdxDBGrid; dxDBGridMaskColumn139: TdxDBGridMaskColumn; dxDBGridMaskColumn140: TdxDBGridMaskColumn; dxDBGridMaskColumn141: TdxDBGridMaskColumn; dxDBGridMaskColumn142: TdxDBGridMaskColumn; dxDBGridMaskColumn143: TdxDBGridMaskColumn; dxDBGridColumn45: TdxDBGridColumn; dxDBGridColumn46: TdxDBGridColumn; dxDBGridColumn47: TdxDBGridColumn; dxDBGridColumn48: TdxDBGridColumn; dxDBGridMaskColumn144: TdxDBGridMaskColumn; dxDBGridColumn49: TdxDBGridColumn; dxDBGridDateColumn23: TdxDBGridDateColumn; dxDBGridDateColumn24: TdxDBGridDateColumn; dxDBGridMaskColumn145: TdxDBGridMaskColumn; dxDBGridMaskColumn146: TdxDBGridMaskColumn; dxDBGridMaskColumn147: TdxDBGridMaskColumn; dxDBGridMaskColumn148: TdxDBGridMaskColumn; dxDBGridMaskColumn149: TdxDBGridMaskColumn; dxDBGridColumn50: TdxDBGridColumn; dxDBGridColumn51: TdxDBGridColumn; dxDBGridColumn52: TdxDBGridColumn; dxDBGridMaskColumn150: TdxDBGridMaskColumn; dxDBGridMaskColumn151: TdxDBGridMaskColumn; dxDBGridMaskColumn152: TdxDBGridMaskColumn; dxDBGridMaskColumn153: TdxDBGridMaskColumn; dxDBGrid12Column26: TdxDBGridColumn; bsSkinButton36: TbsSkinButton; DBCheckBox1: TDBCheckBox; Label70: TLabel; DBComboBoxEh3: TDBComboBoxEh; Label71: TLabel; DBComboBoxEh4: TDBComboBoxEh; Label72: TLabel; DBComboBoxEh5: TDBComboBoxEh; t_msg_mold: TADOQuery; ADOQuery5: TADOQuery; Label67: TLabel; DBEdit31: TDBEdit; t_ch_invoice_item1: TDataSource; t_ch_invoice_item: TADOQuery; cxGrid1: TcxGrid; cxGrid1DBTableView1: TcxGridDBTableView; cxGrid1DBTableView1DBColumn1: TcxGridDBColumn; cxGrid1DBTableView1DBColumn2: TcxGridDBColumn; cxGrid1DBTableView1DBColumn3: TcxGridDBColumn; cxGrid1DBTableView1DBColumn4: TcxGridDBColumn; cxGrid1DBTableView1DBColumn5: TcxGridDBColumn; cxGrid1DBTableView1DBColumn6: TcxGridDBColumn; cxGrid1DBTableView1DBColumn7: TcxGridDBColumn; cxGrid1DBTableView1DBColumn8: TcxGridDBColumn; cxGrid1Level1: TcxGridLevel; Label37: TLabel; wwDBLookupCombo10: TwwDBLookupCombo; cxDBNavigator1: TcxDBNavigator; Label28: TLabel; Label30: TLabel; Label32: TLabel; DBComboBoxEh2: TDBComboBoxEh; DBComboBoxEh6: TDBComboBoxEh; DBComboBoxEh7: TDBComboBoxEh; cxGrid2: TcxGrid; cxGridDBTableView1: TcxGridDBTableView; cxGridDBColumn1: TcxGridDBColumn; cxGridDBColumn2: TcxGridDBColumn; cxGridDBColumn3: TcxGridDBColumn; cxGridDBColumn4: TcxGridDBColumn; cxGridDBColumn5: TcxGridDBColumn; cxGridDBColumn6: TcxGridDBColumn; cxGridDBColumn7: TcxGridDBColumn; cxGridDBColumn8: TcxGridDBColumn; cxGridLevel1: TcxGridLevel; t_ch_invoice_shen_item: TADOQuery; t_ch_invoice_shen_item1: TDataSource; bsSkinButton37: TbsSkinButton; bsSkinButton39: TbsSkinButton; dxDBGrid1Column40: TdxDBGridColumn; dxDBGrid1Column41: TdxDBGridColumn; dxDBGrid2Column27: TdxDBGridColumn; dxDBGrid2Column28: TdxDBGridColumn; Label34: TLabel; DBEdit32: TDBEdit; CheckBox1: TCheckBox; bsSkinPanel8: TbsSkinPanel; Label43: TLabel; DM_CostType: TDBMemo; Label44: TLabel; DM_Money: TDBMemo; bsSkinButton40: TbsSkinButton; dxDBGrid1Column42: TdxDBGridColumn; dxDBGrid2Column29: TdxDBGridColumn; bsSkinDBCheckRadioBox1: TbsSkinDBCheckRadioBox; bsSkinDBCheckRadioBox4: TbsSkinDBCheckRadioBox; dxDBGrid1Column43: TdxDBGridColumn; cxGridDBTableView1DBColumn1: TcxGridDBColumn; cxGrid1DBTableView1DBColumn9: TcxGridDBColumn; Label36: TLabel; DBEdit33: TDBEdit; dxDBGrid11Column27: TdxDBGridColumn; dxDBGrid12Column27: TdxDBGridColumn; dxDBGrid11Column28: TdxDBGridColumn; dxDBGrid11Column29: TdxDBGridColumn; dxDBGrid12Column28: TdxDBGridColumn; dxDBGrid12Column29: TdxDBGridColumn; Label38: TLabel; DBEdit34: TDBEdit; Label39: TLabel; Label40: TLabel; Label42: TLabel; DBEdit35: TDBEdit; dxDBGrid2Column30: TdxDBGridColumn; dxDBGrid1Column44: TdxDBGridColumn; dxDBGrid1Column45: TdxDBGridCheckColumn; bsSkinButton41: TbsSkinButton; bsSkinButton42: TbsSkinButton; PopupMenu6: TPopupMenu; MenuItem3: TMenuItem; MenuItem7: TMenuItem; MenuItem4: TMenuItem; procedure FormClose(Sender: TObject; var Action: TCloseAction); procedure bsSkinButton5Click(Sender: TObject); procedure bsSkinPanel1Resize(Sender: TObject); procedure bsSkinPanel3Resize(Sender: TObject); procedure FormShow(Sender: TObject); procedure t_ch_invoiceAfterInsert(DataSet: TDataSet); procedure bsSkinButton4Click(Sender: TObject); procedure bsSkinButton11Click(Sender: TObject); procedure bsSkinButton13Click(Sender: TObject); procedure bsSkinButton15Click(Sender: TObject); procedure bsSkinButton20Click(Sender: TObject); procedure t_ch_invoiceBeforeInsert(DataSet: TDataSet); procedure t_ch_invoiceBeforePost(DataSet: TDataSet); procedure bsSkinButton18Click(Sender: TObject); procedure bsSkinButton1Click(Sender: TObject); procedure bsSkinButton9Click(Sender: TObject); procedure bsSkinButton16Click(Sender: TObject); procedure N1Click(Sender: TObject); procedure N20Click(Sender: TObject); procedure t_ch_invoiceBeforeEdit(DataSet: TDataSet); procedure RxDBLookupCombo2Change(Sender: TObject); procedure DM_MoneyChange(Sender: TObject); procedure DM_MoneyExit(Sender: TObject); procedure DBSumLowerChange(Sender: TObject); procedure bsSkinButton17Click(Sender: TObject); procedure bsSkinButton12Click(Sender: TObject); procedure bsSkinButton23Click(Sender: TObject); procedure bsSkinButton28Click(Sender: TObject); procedure bsSkinButton29Click(Sender: TObject); procedure bsSkinButton30Click(Sender: TObject); procedure bsSkinButton26Click(Sender: TObject); procedure bsSkinButton25Click(Sender: TObject); procedure RxDBLookupCombo3Enter(Sender: TObject); procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean); procedure bsSkinButton24Click(Sender: TObject); procedure bsSkinButton3Click(Sender: TObject); procedure bsSkinButton31Click(Sender: TObject); procedure N3Click(Sender: TObject); procedure DBEdit12KeyPress(Sender: TObject; var Key: Char); procedure DBEdit16KeyPress(Sender: TObject; var Key: Char); procedure DBEdit17KeyPress(Sender: TObject; var Key: Char); procedure DBEdit18KeyPress(Sender: TObject; var Key: Char); procedure RxDBLookupCombo3KeyPress(Sender: TObject; var Key: Char); procedure RxDBLookupCombo2KeyPress(Sender: TObject; var Key: Char); procedure DE_ShipNameKeyPress(Sender: TObject; var Key: Char); procedure DE_BLNOKeyPress(Sender: TObject; var Key: Char); procedure wwDBDateTimePicker2KeyPress(Sender: TObject; var Key: Char); procedure wwDBLookupCombo11KeyPress(Sender: TObject; var Key: Char); procedure DE_SumUpperKeyPress(Sender: TObject; var Key: Char); procedure DBSumLowerKeyPress(Sender: TObject; var Key: Char); procedure wwDBLookupCombo6KeyPress(Sender: TObject; var Key: Char); procedure DE_BusnessNoKeyPress(Sender: TObject; var Key: Char); procedure DE_TaxNoKeyPress(Sender: TObject; var Key: Char); procedure DE_MakerKeyPress(Sender: TObject; var Key: Char); procedure RxDBLookupCombo3Change(Sender: TObject); procedure bsSkinButton10Click(Sender: TObject); procedure N10Click(Sender: TObject); procedure N14Click(Sender: TObject); procedure N12Click(Sender: TObject); procedure N16Click(Sender: TObject); procedure dxDBGrid1ColumnSorting(Sender: TObject; Column: TdxDBTreeListColumn; var Allow: Boolean); procedure dxDBGrid2ColumnSorting(Sender: TObject; Column: TdxDBTreeListColumn; var Allow: Boolean); procedure bsSkinButton22Click(Sender: TObject); procedure bsSkinButton27Click(Sender: TObject); procedure bsSkinButton32Click(Sender: TObject); procedure N17Click(Sender: TObject); procedure N34Click(Sender: TObject); procedure N36Click(Sender: TObject); procedure N6Click(Sender: TObject); procedure MenuItem2Click(Sender: TObject); procedure dxDBGridMaskColumn2CustomDraw(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 DBEdit1Change(Sender: TObject); procedure DBEdit29KeyPress(Sender: TObject; var Key: Char); procedure wwDBDateTimePicker1KeyPress(Sender: TObject; var Key: Char); procedure wwDBLookupCombo1KeyPress(Sender: TObject; var Key: Char); procedure DBEdit27KeyPress(Sender: TObject; var Key: Char); procedure t_ch_invoiceAfterPost(DataSet: TDataSet); procedure N8Click(Sender: TObject); procedure N19Click(Sender: TObject); procedure DBEdit12Change(Sender: TObject); procedure DE_BLNODblClick(Sender: TObject); procedure DBEdit29DblClick(Sender: TObject); procedure t_ch_invoiceAfterScroll(DataSet: TDataSet); procedure t_ch_invoice1DataChange(Sender: TObject; Field: TField); procedure ComboBoxObjBsCardDropDown(Sender: TObject); procedure ComboBoxObjBsCardKeyPress(Sender: TObject; var Key: Char); procedure dbedt1KeyPress(Sender: TObject; var Key: Char); procedure DBEdit30Change(Sender: TObject); procedure RxDBLookupCombo2Enter(Sender: TObject); procedure bsSkinButton38Click(Sender: TObject); procedure bsSkinButton33Click(Sender: TObject); 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 wwDBLookupCombo6Change(Sender: TObject); procedure DBComboBoxEh1DropDown(Sender: TObject); procedure dbedt1Change(Sender: TObject); procedure DBComboBoxEh1CloseUp(Sender: TObject; Accept: Boolean); procedure bsSkinPageControl1Change(Sender: TObject); procedure bsSkinPageControl6Change(Sender: TObject); procedure dxDBGrid3Column25CustomDraw(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 dxDBGrid4Column25CustomDraw(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 dxDBGrid5Column22CustomDraw(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 dxDBGrid6Column22CustomDraw(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 dxDBGrid3Column24CustomDraw(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 dxDBGrid4Column24CustomDraw(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 dxDBGrid7Column24CustomDraw(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 dxDBGrid8Column24CustomDraw(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 dxDBGrid7Column25CustomDraw(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 dxDBGrid8Column25CustomDraw(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 bsSkinButton35Click(Sender: TObject); procedure bsSkinPanel2Resize(Sender: TObject); procedure bsSkinPageControl2Change(Sender: TObject); procedure dxDBGridColumn43CustomDraw(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 dxDBGridColumn44CustomDraw(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 fra_ch_add_do1MenuItem1Click(Sender: TObject); procedure bsSkinButton36Click(Sender: TObject); procedure DBComboBoxEh3CloseUp(Sender: TObject; Accept: Boolean); procedure DBComboBoxEh3DropDown(Sender: TObject); procedure DBComboBoxEh4CloseUp(Sender: TObject; Accept: Boolean); procedure DBComboBoxEh4DropDown(Sender: TObject); procedure DBComboBoxEh5DropDown(Sender: TObject); procedure DBComboBoxEh5CloseUp(Sender: TObject; Accept: Boolean); procedure DBComboBoxEh1Change(Sender: TObject); procedure bsSkinButton37Click(Sender: TObject); procedure bsSkinButton39Click(Sender: TObject); procedure t_msg_moldAfterInsert(DataSet: TDataSet); procedure t_ch_invoice_itemBeforePost(DataSet: TDataSet); procedure t_ch_invoice_itemNewRecord(DataSet: TDataSet); procedure t_ch_invoice_itemBeforeEdit(DataSet: TDataSet); procedure CheckBox1Click(Sender: TObject); procedure bsSkinButton40Click(Sender: TObject); procedure dxDBGrid2Column29CustomDraw(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 dxDBGrid1Column43CustomDraw(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 t_ch_invoice_itemAfterPost(DataSet: TDataSet); procedure t_ch_invoice_itemBeforeInsert(DataSet: TDataSet); procedure dxDBGrid11DblClick(Sender: TObject); procedure dxDBGrid12DblClick(Sender: TObject); procedure fra_ch_add_do1N1Click(Sender: TObject); procedure bsSkinButton42Click(Sender: TObject); procedure MenuItem3Click(Sender: TObject); procedure MenuItem4Click(Sender: TObject); procedure bsSkinButton41Click(Sender: TObject); private shiji:double; function getfeestr:boolean; { Private declarations } public fname1,fname2,fname3,fname4,fname5,fname6,fname7,fnum:string; fprice1,fprice2,fprice3,fprice4,fprice5,fprice6,fprice7,invremarks:string; main,vessldate,feinum,bibie:thandle; procedure t_ch_invoice_itemvatPriceFieldChange(Sender: TField); { Public declarations } end; var ch_invoice_open:boolean; frm_ch_invoice: Tfrm_ch_invoice; invcontrid:integer; function EnumChildWindowsProc(hwnd,lparam:Integer):Boolean;stdcall;//遍历窗体控件 implementation uses u_main, my_sys_function, u_data_share, u_ch_invoice_add, u_ch_shen_query, u_ch_invoice_query, u_ch_invoice_addone, u_msg_mold, u_code_UsdExRate_Invoice; {$R *.dfm} procedure Tfrm_ch_invoice.t_ch_invoice_itemvatPriceFieldChange(Sender: TField); var price,Amt:double; begin try Sender.DataSet.fieldbyname('单价').asfloat:=Sender.DataSet.fieldbyname('含税单价').asfloat/(1+Sender.DataSet.fieldbyname('税率').asfloat); Sender.DataSet.FieldByName('税额').Value:=s_w(2,Sender.DataSet.fieldbyname('数量').asfloat*Sender.DataSet.fieldbyname('含税单价').asfloat/(1+Sender.DataSet.fieldbyname('税率').asfloat)*Sender.DataSet.fieldbyname('税率').asfloat); Sender.DataSet.FieldByName('金额').Value:=s_w(strtoint(apointnum),Sender.DataSet.fieldbyname('含税单价').asfloat*Sender.DataSet.fieldbyname('数量').asfloat-Sender.DataSet.FieldByName('税额').Value) finally end; end; procedure Tfrm_ch_invoice.FormClose(Sender: TObject; var Action: TCloseAction); begin ch_invoice_open:=false; savereggrid(dxdbgrid1,caption+'1'); savereggrid(dxdbgrid2,caption+'2'); savereggrid(fra_ch_delete_do1.dxDBGrid9,caption+'9'); savereggrid(fra_ch_add_do1.dxDBGrid19,caption+'19'); savereggrid(fra_ch_add_do1.dxDBGrid17,caption+'17'); frm_ch_invoice.Hide; frm_ch_invoice.ManualFloat(frm_ch_invoice.BoundsRect ); frm_main.freeTabs('frm_ch_invoice'); action:=cafree; frm_ch_invoice:=nil; end; procedure Tfrm_ch_invoice.bsSkinButton5Click(Sender: TObject); begin close; end; procedure Tfrm_ch_invoice.bsSkinPanel1Resize(Sender: TObject); var i:integer; begin i:=round(bsSkinPanel1.Width/11); bsSkinButton16.Width:=i; bsSkinButton17.Width:=i; bsSkinButton15.Width:=i; bsSkinButton20.Width:=i; bsSkinButton4.Width:=i; bsSkinButton11.Width:=i; bsSkinButton12.Width:=i; bsSkinButton13.Width:=i; bsSkinButton18.Width:=i; bsSkinButton19.Width:=i; end; procedure Tfrm_ch_invoice.bsSkinPanel3Resize(Sender: TObject); var i:integer; begin //计算按钮长度 if strtobool(get_parameters_value(1,'false'))then begin bsSkinButton25.Caption:='开出发票'; bsSkinButton22.Visible:=false; bsSkinButton27.Visible:=false; i:=round(bsSkinPanel3.Width/10); bsSkinButton23.Width:=i; bsSkinButton24.Width:=i; bsSkinButton28.Width:=i; bsSkinButton29.Width:=i; bsSkinButton30.Width:=i; bsSkinButton25.Width:=i; bsSkinButton26.Width:=i; bsSkinButton31.Width:=i; bsSkinButton33.Width:=i; end else begin bsSkinButton25.Caption:='开出发票'; bsSkinButton22.Visible:=true; bsSkinButton27.Visible:=true; i:=round(bsSkinPanel3.Width/13); bsSkinButton23.Width:=i; bsSkinButton24.Width:=i; bsSkinButton28.Width:=i; bsSkinButton29.Width:=i; bsSkinButton30.Width:=i; bsSkinButton25.Width:=i; bsSkinButton26.Width:=i; bsSkinButton31.Width:=i; bsSkinButton22.Width:=i; bsSkinButton27.Width:=i; bsSkinButton23.Width:=i; bsSkinButton33.Width:=i; end; bsSkinButton32.Left:=dxDBGrid2.Width-bsSkinButton32.Width-20; end; procedure Tfrm_ch_invoice.FormShow(Sender: TObject); var inifile1:Tinifile; begin inifile1:=Tinifile.Create(ExtractFilePath(application.ExeName)+'main.ini'); bsSkinPanel8.Visible:=inifile1.Readbool('other','invoicedsp',True); CheckBox1.Checked:=inifile1.Readbool('other','invoicedsp',True); inifile1.free; t_ch_invoice.close; t_ch_invoice.sql.clear; t_ch_invoice.sql.add('select top 50 * from t_ch_invoice where ' +open_data('1001','申请人','制单人','no','no','no') +' order by 开票日期 desc'); t_ch_invoice.open; ch_invoice_open:=true; TNumericField(t_ch_invoice.FieldByName('合计金额')).DisplayFormat:='#,##0.00;-#,##0.00'; ADOQuery1.open; ADOQuery2.open; ADOQuery3.open; ADOQuery4.open; // t_ch_invoice_head.open; //多业务合并处理 bsSkinPageControl1.ActivePageIndex:=0; if StrToBool(get_parameters_value(85,'false')) then begin fra_ch_add_do1.bsSkinTabSheet1.TabVisible:=False; fra_ch_add_do1.bsSkinTabSheet2.TabVisible:=False; fra_ch_add_do1.bsSkinTabSheet3.TabVisible:=False; fra_ch_add_do1.bsSkinTabSheet4.TabVisible:=False; fra_ch_add_do1.bsSkinTabSheet5.TabVisible:=True; fra_ch_add_do1.bsSkinPageControl1.TabIndex:=0; // fra_ch_add_do1.bsSkinButton11.Caption:='开出发票'; fra_ch_delete_do1.bsSkinTabSheet1.TabVisible:=false; fra_ch_delete_do1.bsSkinTabSheet2.TabVisible:=false; fra_ch_delete_do1.bsSkinTabSheet3.TabVisible:=false; fra_ch_delete_do1.bsSkinTabSheet4.TabVisible:=false; fra_ch_delete_do1.bsSkinTabSheet5.TabVisible:=True; fra_ch_delete_do1.bsSkinPageControl1.ActivePage:=fra_ch_delete_do1.bsSkinTabSheet5; fra_ch_add_do1.do_ban_fee1.DataSet:=fra_ch_delete_do1.v_fee_do_bscard; end else begin fra_ch_add_do1.bsSkinTabSheet1.TabVisible:=True; fra_ch_add_do1.bsSkinTabSheet2.TabVisible:=True; fra_ch_add_do1.bsSkinTabSheet3.TabVisible:=True; fra_ch_add_do1.bsSkinTabSheet4.TabVisible:=True; fra_ch_add_do1.bsSkinPageControl1.ActivePage:=fra_ch_add_do1.bsSkinTabSheet1; fra_ch_add_do1.bsSkinTabSheet5.TabVisible:=False; fra_ch_delete_do1.bsSkinTabSheet1.TabVisible:=True; fra_ch_delete_do1.bsSkinTabSheet2.TabVisible:=True; fra_ch_delete_do1.bsSkinTabSheet3.TabVisible:=True; fra_ch_delete_do1.bsSkinTabSheet4.TabVisible:=True; fra_ch_delete_do1.bsSkinTabSheet5.TabVisible:=false; fra_ch_delete_do1.bsSkinPageControl1.ActivePage:=fra_ch_delete_do1.bsSkinTabSheet1; fra_ch_add_do1.do_ban_fee1.DataSet:=fra_ch_delete_do1.v_fee_do_seae; end; fra_ch_add_do1.do_ban1.DataSet:=t_ch_invoice; fra_ch_add_do1.bs_text.text:='1'; fra_ch_add_do1.wwDBComboBox31.text:='收'; fra_ch_add_do1.t_ch_fee_do.open; fra_ch_add_do1.bsSkinCheckRadioBox4.Checked:=False; fra_ch_add_do1.bsSkinPanel9.Visible:=true; fra_ch_delete_do1.bs_text.Text:='1'; fra_ch_delete_do1.do_ban1.DataSet:=t_ch_invoice; t_ch_invoice_item.Close; t_ch_invoice_item.open; t_ch_invoice_shen_item.Close; t_ch_invoice_shen_item.open; loadreggrid(dxdbgrid1,false,caption+'1'); loadreggrid(dxdbgrid2,false,caption+'2'); loadreggrid(fra_ch_delete_do1.dxDBGrid9,false,caption+'9'); loadreggrid(fra_ch_add_do1.dxDBGrid19,false,caption+'19'); loadreggrid(fra_ch_add_do1.dxDBGrid17,false,caption+'17'); frm_data_share.t_crm_client_all.requery; frm_data_share.t_code_currency.requery; t_sys_bank.open; //是否注册税控接口 if not if_reg(417) then begin bsSkinButton34.Visible:=false; bsSkinButton35.Visible:=false; end; {$IFDEF FPSHENQING} {$ELSE} bsSkinTabSheet3.TabVisible:=false; {$ENDIF} t_ch_invoice_item.FieldByName('含税单价').OnChange:=t_ch_invoice_itemvatPriceFieldChange; t_ch_invoice_item.FieldByName('数量').OnChange:=t_ch_invoice_itemvatPriceFieldChange; end; procedure Tfrm_ch_invoice.t_ch_invoiceAfterInsert(DataSet: TDataSet); begin t_ch_invoice['制单人']:=employee; t_ch_invoice['开票日期']:=date; t_ch_invoice['合计金额']:=0; t_ch_invoice['实际金额']:=0; t_ch_invoice['虚开金额']:=0; t_ch_invoice['自动']:=1; t_ch_invoice['工商登记号']:=Trim(frm_data_share.t_sys_company.fieldbyname('工商登记号').AsString); t_ch_invoice['税务登记号']:=Trim(frm_data_share.t_sys_company.fieldbyname('税务登记号').AsString); t_ch_invoice['复核状态']:=0; t_ch_invoice['是否打印']:=0; t_ch_invoice['是否废除']:=0; t_ch_invoice['是否锁定']:=0; t_ch_invoice['币别']:='RMB'; t_ch_invoice['是否打印银行帐号名称']:=1; t_ch_invoice['税率']:=0; end; procedure Tfrm_ch_invoice.bsSkinButton4Click(Sender: TObject); begin if strtobool(get_parameters_value(5,'FALSE'))then begin try frm_ch_invoice_add:=tfrm_ch_invoice_add.Create (self); frm_ch_invoice_add.bsSkinCheckRadioBox1.enabled:=false; frm_ch_invoice_add.bsSkinCheckRadioBox2.Visible:=false; frm_ch_invoice_add.wwDBLookupCombo6.Text:='RMB'; if t_ch_invoice.IsEmpty then frm_ch_invoice_add.bsSkinCheckRadioBox8.enabled:=false; frm_ch_invoice_add.ShowModal; finally frm_ch_invoice_add.Free; end; end else begin showmessage('对不起不能开具自由发票!!'); end; end; procedure Tfrm_ch_invoice.bsSkinButton11Click(Sender: TObject); begin table_post(t_ch_invoice); end; procedure Tfrm_ch_invoice.bsSkinButton13Click(Sender: TObject); begin table_cancel(t_ch_invoice); end; procedure Tfrm_ch_invoice.bsSkinButton15Click(Sender: TObject); begin table_Prior(t_ch_invoice); end; procedure Tfrm_ch_invoice.bsSkinButton20Click(Sender: TObject); begin table_next(t_ch_invoice); end; procedure Tfrm_ch_invoice.t_ch_invoiceBeforeInsert(DataSet: TDataSet); begin if not modify_all then abort; end; procedure Tfrm_ch_invoice.t_ch_invoiceBeforePost(DataSet: TDataSet); var currency_chi:String; total_money:Double; aAdoQuery :TAdoQuery; begin t_ch_invoice['实际金额']:=s_w(StrToInt(apointnum),t_ch_invoice['实际金额']); if (t_ch_invoice.state=dsinsert) and (t_ch_invoice.FieldByName('申请编号').asstring='') then t_ch_invoice['申请编号']:=get_no(date,'IA'); if (frm_ch_invoice.t_ch_invoice.fieldbyname('发票类别').asstring<>'申请发票') and (shiji<>t_ch_invoice.FieldByName('实际金额').value) then t_ch_invoice['合计金额']:=t_ch_invoice['实际金额']; total_money:=Abs(t_ch_invoice['合计金额']); if t_ch_invoice['币别']='RMB' then currency_chi:='';//人民币 if t_ch_invoice['币别']='USD' then currency_chi:=''; //美元 if abs(t_ch_invoice['合计金额'])>0.1 then begin if t_ch_invoice['合计金额']<0 then begin t_ch_invoice['金额大写']:=invoice_max(total_money,currency_chi+'(付)'); end else t_ch_invoice['金额大写']:=invoice_max(t_ch_invoice['合计金额'],currency_chi); end else t_ch_invoice['金额大写']:=t_ch_invoice['合计金额']; if Trim(t_ch_invoice.fieldbyname('申请编号').AsString)<>'' then begin aAdoQuery:=CreateAdoQuery; with aAdoQuery do try close; SQL.clear; sql.add('select '); sql.Add('sum(case when 类型=''收'' and 原始币别=''RMB'' then 原始金额 else 0 end) as 收人民币'); sql.Add(',sum(case when 类型=''收'' and 原始币别<>''RMB'' then 原始金额 else 0 end) as 收外币'); sql.Add(',sum(case when 类型=''付'' and 原始币别=''RMB'' then 原始金额 else 0 end) as 付人民币'); sql.Add(',sum(case when 类型=''付'' and 原始币别<>''RMB'' then 原始金额 else 0 end) as 付外币'); sql.Add('from v_fee_do_bscard '); sql.Add('where 工作编号=:工作编号 '); Parameters.ParamByName('工作编号').Value:=t_ch_invoice.fieldbyname('申请编号').AsString; Open;First; t_ch_invoice.FieldByName('人民币').value:=FieldByName('收人民币').AsFloat-FieldByName('付人民币').AsFloat; t_ch_invoice.FieldByName('外币').value:=FieldByName('收外币').AsFloat-FieldByName('付外币').AsFloat; finally Free; end; end; t_ch_invoice['虚开金额']:=t_ch_invoice['合计金额']-t_ch_invoice['实际金额']; table_before_post(t_ch_invoice,'发票号码'); table_before_post(t_ch_invoice,'币别'); end; procedure Tfrm_ch_invoice.bsSkinButton18Click(Sender: TObject); begin bsSkinTabSheet1.Show; end; procedure Tfrm_ch_invoice.bsSkinButton1Click(Sender: TObject); begin bsSkinTabSheet2.Show; if StrToBool(get_parameters_value(85,'false')) then begin bsSkinTabSheet8.TabVisible:=false; bsSkinTabSheet9.TabVisible:=false; bsSkinTabSheet10.TabVisible:=false; bsSkinTabSheet12.TabVisible:=false; bsSkinTabSheet13.TabVisible:=true; v_fee_do_bscard.Close; v_fee_do_bscard.DataSource:=t_ch_invoice1; v_fee_do_bscard.Open; ADOQuery1.Close; ADOQuery2.Close; ADOQuery3.Close; ADOQuery4.Close; end else begin bsSkinTabSheet8.TabVisible:=true; bsSkinTabSheet9.TabVisible:=true; bsSkinTabSheet10.TabVisible:=true; bsSkinTabSheet12.TabVisible:=true; bsSkinTabSheet13.TabVisible:=false; ADOQuery1.open; ADOQuery2.open; ADOQuery3.open; ADOQuery4.open; v_fee_do_bscard.Close; end; end; procedure Tfrm_ch_invoice.bsSkinButton9Click(Sender: TObject); var Pnt:Tpoint; begin Pnt:=bsSkinButton9.ClientToScreen(Point(0,bsSkinButton9.Height)); PopupMenu2.Popup(Pnt.x,Pnt.y); end; procedure Tfrm_ch_invoice.bsSkinButton16Click(Sender: TObject); var Pnt:Tpoint; begin Pnt:=bsSkinButton16.ClientToScreen(Point(0,bsSkinButton16.Height)); PopupMenu2.Popup(Pnt.x,Pnt.y); end; procedure Tfrm_ch_invoice.N1Click(Sender: TObject); begin if t_ch_invoice.IsEmpty then exit; if t_ch_invoice.FieldByName('是否废除').asboolean then begin showmessage('发票已经废除,不能打印!!'); exit; end; if Trim(t_ch_invoice.FieldByName('发票抬头').AsString)='' then begin showmessage('发票抬头为空,不能打印!!'); exit; end; if t_ch_invoice.state in [dsedit,dsinsert] then t_ch_invoice.post; if not t_ch_invoice.FieldByName('是否打印').asboolean then begin t_ch_invoice.Edit; t_ch_invoice['是否打印']:=1; t_ch_invoice.post; end; sys_print('业务发票打印',1,t_ch_invoice1,nil,nil,nil,DataSource1,DataSource2,DataSource3,DataSource4,t_ch_invoice1,nil,nil); end; procedure Tfrm_ch_invoice.N20Click(Sender: TObject); begin if t_ch_invoice.IsEmpty then exit; if t_ch_invoice.FieldByName('是否废除').asboolean then begin showmessage('发票已经废除,不能打印!!'); exit; end; if Trim(t_ch_invoice.FieldByName('发票抬头').AsString)='' then begin showmessage('发票抬头为空,不能打印!!'); exit; end; if t_ch_invoice.state in [dsedit,dsinsert] then t_ch_invoice.post; if not t_ch_invoice.FieldByName('是否打印').asboolean then begin t_ch_invoice.Edit; t_ch_invoice['是否打印']:=1; t_ch_invoice.post; end; sys_print('业务发票打印',2,t_ch_invoice1,nil,nil,nil,DataSource1,DataSource2,DataSource3,DataSource4,t_ch_invoice1,nil,nil); end; procedure Tfrm_ch_invoice.t_ch_invoiceBeforeEdit(DataSet: TDataSet); begin if not modify_all then begin if t_ch_invoice.FieldByName('是否废除').asboolean then begin showmessage('发票已经废除,不能修改!!'); abort; end; if t_ch_invoice.FieldByName('财务').asboolean then begin showmessage('发票生成凭证,不能修改!!'); abort; end; if t_ch_invoice.FieldByName('是否打印').asboolean then begin showmessage('发票已经打印,不能修改!!'); abort; end; if t_ch_invoice.FieldByName('是否锁定').asboolean then begin showmessage('发票已经锁定,不能修改!!'); abort; end; end; shiji:=t_ch_invoice.fieldbyname('实际金额').asfloat; end; procedure Tfrm_ch_invoice.RxDBLookupCombo2Change(Sender: TObject); begin try // if (t_ch_invoice.state=dsinsert) or (t_ch_invoice.state=dsedit) then // begin if not t_sys_bank.IsEmpty then if t_sys_bank.Locate('代码',RxDBLookupCombo2.DisplayValues[0],[])then begin t_ch_invoice.Edit; t_ch_invoice['开户银行']:=t_sys_bank.fieldbyname('银行名称').asstring; t_ch_invoice['银行账号']:=t_sys_bank.fieldbyname('银行账号').asstring; end; // end; except ; end; end; procedure Tfrm_ch_invoice.DM_MoneyChange(Sender: TObject); VAR total_money:real; currency_chi:string; begin try if (t_ch_invoice.state=dsinsert) or (t_ch_invoice.state=dsedit) then begin if frm_data_share.t_code_currency.Locate('币别',wwDBLookupCombo6.text,[])then total_money:=total_num(DM_Money); t_ch_invoice['合计金额']:=total_money; if total_money<0 then begin total_money:=Abs(total_money); t_ch_invoice['金额大写']:=invoice_max(total_money,'负'+currency_chi); end else t_ch_invoice['金额大写']:=invoice_max(total_money,currency_chi); end; except ; end; end; procedure Tfrm_ch_invoice.DM_MoneyExit(Sender: TObject); begin if (t_ch_invoice.State=dsedit)or(t_ch_invoice.State=dsinsert)then begin add_zero(DM_Money); t_ch_invoice['金额列表']:=DM_Money.text; end; end; procedure Tfrm_ch_invoice.DBSumLowerChange(Sender: TObject); VAR total_money:real; currency_chi,str_currency:string; begin try if (t_ch_invoice.state=dsinsert) or (t_ch_invoice.state=dsedit) then begin if frm_data_share.t_code_currency.Locate('币别',wwDBLookupCombo6.text,[])then currency_chi:=frm_data_share.t_code_currency.fieldbyname('中文名').asstring; str_currency:=StringReplace(DBSumLower.text,',','',[rfReplaceAll]); total_money:=strtofloat(str_currency); if total_money<0 then begin total_money:=Abs(total_money); t_ch_invoice['金额大写']:=invoice_max(total_money,currency_chi+'(付)'); end else t_ch_invoice['金额大写']:=invoice_max(total_money,currency_chi); end; except ; end; end; procedure Tfrm_ch_invoice.bsSkinButton17Click(Sender: TObject); begin if t_ch_invoice.IsEmpty then exit; if not if_open('031') then begin showmessage('对不起你没有此模块的操作权限!'); exit; end; if t_ch_invoice.FieldByName('是否废除').asboolean then begin showmessage('发票已经废除,不能取消打印!!'); exit; end; if t_ch_invoice.FieldByName('是否打印').asboolean then begin if application.MessageBox('您确定要取消打印吗?','警告:',MB_OKCANCEL)=IDOK then begin try modify_all:=true; t_ch_invoice.Edit; t_ch_invoice['是否打印']:=0; t_ch_invoice.post; finally modify_all:=false; end; end; end; end; procedure Tfrm_ch_invoice.bsSkinButton12Click(Sender: TObject); var str:widestring; if_shen:string; in_id,I:integer; aQuery:TADOQuery; alistBsNo:TStringList; begin //删除发票处理,已打印只能废除,不能删除 if t_ch_invoice.IsEmpty then exit; if t_ch_invoice.FieldByName('财务').asboolean then begin showmessage('发票已经生成凭证不能删除和修改,请删除凭证,在删除发票!!'); Exit; end; if t_ch_invoice.FieldByName('是否锁定').asboolean then begin showmessage('发票已经锁定不能删除和修改,请删除凭证,在删除发票!!'); abort; end; if t_ch_invoice.FieldByName('是否废除').asboolean then begin if if_open('309') then begin modify_all:=true; t_ch_invoice.Edit; t_ch_invoice['是否废除']:=0; t_ch_invoice['废除原因']:=''; t_ch_invoice['废除人']:=''; t_ch_invoice['废除日期']:=null; t_ch_invoice['申请编号']:=''; t_ch_invoice.post; modify_all:=false; end else begin showmessage('对不起,你没有撤销废除的权限!!'); end; exit; end; if_shen:=t_ch_invoice.fieldbyname('发票类别').asstring; if t_ch_invoice.FieldByName('是否打印').asboolean then begin str:=trim(InputBox('请输入废除原因', '废除原因:', '')); if str=''then begin showmessage('废除原因不能为空,废除失败!!'); exit; end else if str=''then begin exit; end; in_id:=t_ch_invoice.FieldByName('IN_ID').asinteger; t_ch_invoice.Refresh; if not t_ch_invoice.locate('IN_ID',in_id,[]) then exit; try if t_ch_invoice.FieldByName('发票类别').AsString<>'申请发票' then begin aQuery:=CreateAdoQuery; try with aQuery do begin Close;SQL.Clear; SQL.Add('select * from t_ch_fee_do where 类型=''1'' and 工作编号='''+t_ch_invoice.FieldByName('申请编号').AsString+''''); Open; first; while not eof do begin Delete; end; end; t_ch_invoice_item.first; while not t_ch_invoice_item.eof do t_ch_invoice_item.delete; finally FreeAndNil(aQuery); end; end else begin aQuery:=CreateAdoQuery; alistBsNo:=TStringList.Create; alistBsNo.Clear; try with aQuery do begin Close;SQL.Clear; SQL.Add('select * from t_ch_fee_do where 类型=''1'' and 工作编号='''+t_ch_invoice.FieldByName('申请编号').AsString+''''); Open; first; while not eof do begin edit; fieldbyname('类型').AsString:='7'; post; // ShowMessage(alistBsNo.Text); alistBsNo.IndexOf(fieldbyname('业务编号').Asstring); if alistBsNo.IndexOf(fieldbyname('业务编号').Asstring)<0 then alistBsNo.Add(fieldbyname('业务编号').Asstring); next; end; end; finally FreeAndNil(aQuery); end; try if alistBsNo.Count>=1 then begin for i :=0 to alistBsNo.Count-1 do begin UpdateInviceRemarks(alistBsNo[i],'t_op_seae',1); UpdateInviceRemarks(alistBsNo[i],'t_op_Aire',1); end; end; finally alistBsNo.Free; end; end; modify_all:=true; t_ch_invoice.Edit; t_ch_invoice['是否废除']:=1; t_ch_invoice['废除原因']:=str; t_ch_invoice['废除人']:=employee; t_ch_invoice['废除日期']:=now; t_ch_invoice['申请编号']:=''; t_ch_invoice.post; modify_all:=false; except modify_all:=false; showmessage('废除失败!!'); exit; end; end else begin if application.MessageBox('您确定要删除数据吗?','警告:',MB_OKCANCEL)=IDOK then begin if t_ch_invoice.FieldByName('发票类别').AsString<>'申请发票' then begin aQuery:=CreateAdoQuery; try with aQuery do begin Close;SQL.Clear; SQL.Add('select * from t_ch_fee_do where 类型=''1'' and 工作编号='''+t_ch_invoice.FieldByName('申请编号').AsString+''''); Open; first; while not eof do begin Delete; end; end; t_ch_invoice_item.first; while not t_ch_invoice_item.eof do t_ch_invoice_item.delete; finally FreeAndNil(aQuery); end; end else begin aQuery:=CreateAdoQuery; alistBsNo:=TStringList.Create; alistBsNo.Clear; try with aQuery do begin Close;SQL.Clear; SQL.Add('select * from t_ch_fee_do where 类型=''1'' and 工作编号='''+t_ch_invoice.FieldByName('申请编号').AsString+''''); Open; first; while not eof do begin edit; fieldbyname('类型').AsString:='7'; post; alistBsNo.IndexOf(fieldbyname('业务编号').Asstring); if alistBsNo.IndexOf(fieldbyname('业务编号').Asstring)<0 then alistBsNo.Add(fieldbyname('业务编号').Asstring); next; end; end; try if alistBsNo.Count>=1 then begin for i :=0 to alistBsNo.Count-1 do begin UpdateInviceRemarks(alistBsNo[i],'t_op_seae',1); UpdateInviceRemarks(alistBsNo[i],'t_op_Aire',1); end; end; finally alistBsNo.Free; end; finally FreeAndNil(aQuery); end; end; t_ch_invoice.delete; end else exit; end; if if_shen<>'自由发票'then begin t_ch_invoice_shen.requery; end; end; procedure Tfrm_ch_invoice.bsSkinButton23Click(Sender: TObject); begin sys_print('业务发票申请',2,t_ch_invoice_shen1,nil,nil,nil,v_fee_do_seae1,v_fee_do_seai1,v_fee_do_aire1,v_fee_do_airi1,t_ch_invoice_shen1,nil,nil); end; procedure Tfrm_ch_invoice.bsSkinButton28Click(Sender: TObject); begin table_Prior(t_ch_invoice_shen); end; procedure Tfrm_ch_invoice.bsSkinButton29Click(Sender: TObject); begin table_next(t_ch_invoice_shen); end; procedure Tfrm_ch_invoice.bsSkinButton30Click(Sender: TObject); begin if bsSkinButton30.Caption='详细内容' then begin if t_ch_invoice_shen.IsEmpty then exit; bsSkinTabSheet22.show; bsSkinButton30.Caption:='返回列表'; end else begin bsSkinTabSheet11.show; bsSkinButton30.Caption:='详细内容'; end; if StrToBool(get_parameters_value(85,'false')) then begin bsSkinTabSheet4.TabVisible:=false; bsSkinTabSheet5.TabVisible:=false; bsSkinTabSheet6.TabVisible:=false; bsSkinTabSheet7.TabVisible:=false; bsSkinTabSheet14.TabVisible:=true; v_fee_do_bscard.Close; v_fee_do_bscard.DataSource:=t_ch_invoice_shen1; v_fee_do_bscard.Open; v_fee_do_seae.Close; v_fee_do_seai.Close; v_fee_do_aire.Close; v_fee_do_airi.Close; end else begin bsSkinTabSheet4.TabVisible:=true; bsSkinTabSheet5.TabVisible:=true; bsSkinTabSheet6.TabVisible:=true; bsSkinTabSheet7.TabVisible:=true; bsSkinTabSheet14.TabVisible:=false; v_fee_do_seae.open; v_fee_do_seai.open; v_fee_do_aire.open; v_fee_do_airi.open; v_fee_do_bscard.Close; end; end; procedure Tfrm_ch_invoice.bsSkinButton26Click(Sender: TObject); begin if t_ch_invoice_shen.IsEmpty then exit; if (t_ch_invoice_shen.FieldByName('申请类别').asstring='实际开票')then begin shen_back(t_ch_invoice_shen); end else begin if (t_ch_invoice_shen.FieldByName('申请状态').asstring='提交申请')or (t_ch_invoice_shen.FieldByName('申请状态').asstring='开出发票')or (t_ch_invoice_shen.FieldByName('申请状态').asstring='批准开票')or (t_ch_invoice_shen.FieldByName('申请状态').asstring='禁止修改')then begin t_ch_invoice_shen.Edit; t_ch_invoice_shen['申请状态']:='驳回申请'; t_ch_invoice_shen['审核人']:=employee; t_ch_invoice_shen['审核日期']:=now; t_ch_invoice_shen.post; t_ch_invoice_shen.Refresh; end else begin showmessage('当前业务状态不能驳回申请!!'); end; end; end; procedure Tfrm_ch_invoice.bsSkinButton25Click(Sender: TObject); var sdate:TDate; aList,aListCurrency:TStringList; i:integer; billnos:string; Current,bm: TBookmarkStr; begin if t_ch_invoice_shen.IsEmpty then exit; { aList:=TStringList.create; aListCurrency:=TStringList.create; try t_ch_invoice_shen.DisableControls; if dxDBGrid2.SelectedCount>0 then begin billnos:=''; aList.Clear; for i:=0 to dxDBGrid2.SelectedCount-1 do begin t_ch_invoice_shen.GotoBookmark(pointer(dxDBGrid2.selectedrows[i])); if aList.IndexOf(t_ch_invoice_shen['客户名称'])<0 then aList.Add(t_ch_invoice_shen['客户名称']); if aListCurrency.IndexOf(t_ch_invoice_shen['币别'])<0 then aListCurrency.Add(t_ch_invoice_shen['币别']); if billnos='' then billnos:=t_ch_invoice_shen.fieldbyname('申请编号').asstring else billnos:=billnos+','+t_ch_invoice_shen.fieldbyname('申请编号').asstring; end; if aList.Count>1 then begin showmessage('不相同的客户不能同时开票:'+#13#10+aList.Text); exit; end; if aListCurrency.Count>1 then begin showmessage('不相同的币别不能同时开票:'+#13#10+aListCurrency.Text); exit; end; end else begin billnos:=''; aList.Clear; aList.Add(t_ch_invoice_shen['客户名称']); if billnos='' then billnos:=t_ch_invoice_shen.fieldbyname('申请编号').asstring else billnos:=billnos+','+t_ch_invoice_shen.fieldbyname('申请编号').asstring; if aList.Count=0 then begin showmessage('没有需要开票的信息:'+#13#10+aList.Text); exit; end; end; finally aList.free; aListCurrency.free; t_ch_invoice_shen.EnableControls; end; } if (t_ch_invoice_shen.FieldByName('申请类别').asstring<>'实际开票')then begin if (t_ch_invoice_shen.FieldByName('申请状态').asstring='提交申请')or (t_ch_invoice_shen.FieldByName('申请状态').asstring='驳回申请')or (t_ch_invoice_shen.FieldByName('申请状态').asstring='批准开票')or (t_ch_invoice_shen.FieldByName('申请状态').asstring='禁止修改')then begin t_ch_invoice_shen.Edit; t_ch_invoice_shen['申请状态']:='开出发票'; t_ch_invoice_shen['审核人']:=employee; t_ch_invoice_shen['审核日期']:=now; t_ch_invoice_shen.post; t_ch_invoice_shen.Refresh; end else begin showmessage('当前业务状态不能批准开出发票!!'); end; end else begin if strtobool(get_parameters_value(1,'false')) then begin if (t_ch_invoice_shen.FieldByName('申请状态').asstring<>'批准开票') and (t_ch_invoice_shen.FieldByName('申请状态').asstring<>'禁止修改') then begin showmessage('当前申请状态不能开出发票!!'); exit; end; end else begin if (t_ch_invoice_shen.FieldByName('申请状态').asstring<>'批准开票') and (t_ch_invoice_shen.FieldByName('申请状态').asstring<>'禁止修改') and (t_ch_invoice_shen.FieldByName('申请状态').asstring<>'提交申请') then begin showmessage('当前申请状态不能开出发票!!'); exit; end; end; try frm_ch_invoice_add:=tfrm_ch_invoice_add.Create (self); frm_ch_invoice_add.bsSkinCheckRadioBox1.checked:=true; frm_ch_invoice_add.bsSkinCheckRadioBox7.enabled:=false; frm_ch_invoice_add.bsSkinCheckRadioBox8.enabled:=false; frm_ch_invoice_add.wwDBLookupCombo6.Text:=t_ch_invoice_shen.fieldbyname('币别').asstring; frm_ch_invoice_add.wwDBLookupCombo6.ReadOnly:=true; frm_ch_invoice_add.edit2.text:=t_ch_invoice_shen.fieldbyname('客户名称').asstring; frm_ch_invoice_add.edit2.Visible:=true; frm_ch_invoice_add.RxDBLookupCombo3.Visible:=false; if billnos<>'' then frm_ch_invoice_add.Memo1.text:='申请号码:'+billnos; if t_ch_invoice_shen.FieldByName('开船日期').asstring<>''then begin { if (date-t_ch_invoice_shen.FieldByName('开船日期').asdatetime)>7 then begin showmessage('警告:发票开船日期超过了税务局要求的7天限制!!'); end; } end; frm_ch_invoice_add.ShowModal; finally t_ch_invoice_item.Requery(); frm_ch_invoice_add.Free; end; end; end; procedure Tfrm_ch_invoice.RxDBLookupCombo3Enter(Sender: TObject); begin if DBEdit12.text='申请发票' then begin RxDBLookupCombo3.ReadOnly:=true; {DBEdit19.ReadOnly:=true; DE_ShipName.ReadOnly:=true; DE_BLNO.ReadOnly:=true; wwDBDateTimePicker2.ReadOnly:=true; wwDBLookupCombo10.ReadOnly:=true; wwDBLookupCombo11.ReadOnly:=true; wwDBLookupCombo12.ReadOnly:=true; DM_ChaCon.ReadOnly:=true; DM_CostType.ReadOnly:=true; DM_Money.ReadOnly:=true; DE_SumUpper.ReadOnly:=true; DBSumLower.ReadOnly:=true; } wwDBLookupCombo6.ReadOnly:=true; end else begin RxDBLookupCombo3.ReadOnly:=false; wwDBLookupCombo6.ReadOnly:=false; if StrToBool(get_parameters_value(85,'false')) then begin if fra_ch_delete_do1.v_fee_do_bscard.IsEmpty then begin RxDBLookupCombo3.ReadOnly:=false; wwDBLookupCombo6.ReadOnly:=false; end else begin RxDBLookupCombo3.ReadOnly:=true; wwDBLookupCombo6.ReadOnly:=true; end; end else begin if fra_ch_delete_do1.v_fee_do_seae.IsEmpty and fra_ch_delete_do1.v_fee_do_seai.IsEmpty and fra_ch_delete_do1.v_fee_do_aire.IsEmpty and fra_ch_delete_do1.v_fee_do_airi.IsEmpty then begin RxDBLookupCombo3.ReadOnly:=false; wwDBLookupCombo6.ReadOnly:=false; end else begin RxDBLookupCombo3.ReadOnly:=true; wwDBLookupCombo6.ReadOnly:=true; end; end; end; end; procedure Tfrm_ch_invoice.FormCloseQuery(Sender: TObject; var CanClose: Boolean); begin CanClose:=frm_close_query(t_ch_invoice); end; procedure Tfrm_ch_invoice.bsSkinButton24Click(Sender: TObject); begin try frm_ch_shen_query:=tfrm_ch_shen_query.Create (self); shen_query_type:=3; shen_query_limited:='no'; shen_query_op_limited:='no'; frm_ch_shen_query.ShowModal; finally frm_ch_shen_query.Free; end; end; procedure Tfrm_ch_invoice.bsSkinButton3Click(Sender: TObject); begin if t_ch_invoice.IsEmpty then exit; if t_ch_invoice.FieldByName('发票类别').asstring<>'申请发票'then begin showmessage('当前发票不是申请发票!!'); exit; end; if t_ch_invoice.FieldByName('是否废除').asboolean then begin showmessage('当前发票已经废除!!'); exit; end; if not t_ch_invoice_shen.Locate('申请编号',t_ch_invoice.fieldbyname('申请编号').asstring,[])then begin t_ch_invoice_shen.close; t_ch_invoice_shen.sql.clear; t_ch_invoice_shen.sql.add('select * from t_ch_invoice_shen where 申请编号=' +''''+t_ch_invoice.fieldbyname('申请编号').asstring+''''); t_ch_invoice_shen.open; t_ch_invoice_shen_item.Close; t_ch_invoice_shen_item.open; end; bsSkinTabSheet22.Show; end; procedure Tfrm_ch_invoice.bsSkinButton31Click(Sender: TObject); begin if t_ch_invoice_shen.IsEmpty then exit; if t_ch_invoice_shen.FieldByName('申请状态').asstring<>'开出发票'then begin showmessage('当前申请还没有开出发票!!'); exit; end; if not t_ch_invoice.Locate('发票号码',t_ch_invoice_shen.fieldbyname('发票号码').asstring,[])then begin t_ch_invoice.close; t_ch_invoice.sql.clear; t_ch_invoice.sql.add('select * from t_ch_invoice where 发票号码=' +''''+t_ch_invoice_shen.fieldbyname('发票号码').asstring+''''); t_ch_invoice.open; end; if not t_ch_invoice.IsEmpty then bsSkinTabSheet2.Show else showmessage('没有找到相应的发票信息!!'); end; procedure Tfrm_ch_invoice.N3Click(Sender: TObject); begin if t_ch_invoice.IsEmpty then exit; if t_ch_invoice.FieldByName('是否废除').asboolean then begin showmessage('发票已经废除,不能打印!!'); exit; end; if Trim(t_ch_invoice.FieldByName('发票抬头').AsString)='' then begin showmessage('发票抬头为空,不能打印!!'); exit; end; if t_ch_invoice.state in [dsedit,dsinsert] then t_ch_invoice.post; if not t_ch_invoice.FieldByName('是否打印').asboolean then begin t_ch_invoice.Edit; t_ch_invoice['是否打印']:=1; t_ch_invoice.post; end; sys_print('业务发票打印',3,t_ch_invoice1,nil,nil,nil,DataSource1,DataSource2,DataSource3,DataSource4,t_ch_invoice1,nil,nil); // bsSkinButton4Click(sender); end; procedure Tfrm_ch_invoice.DBEdit12KeyPress(Sender: TObject; var Key: Char); begin key_DBEdit(Key,DBEdit16); end; procedure Tfrm_ch_invoice.DBEdit16KeyPress(Sender: TObject; var Key: Char); begin key_DBEdit(Key,DBEdit17); end; procedure Tfrm_ch_invoice.DBEdit17KeyPress(Sender: TObject; var Key: Char); begin key_DBEdit(Key,DBEdit18); end; procedure Tfrm_ch_invoice.DBEdit18KeyPress(Sender: TObject; var Key: Char); begin key_RxDBLookupCombo(Key,RxDBLookupCombo3); end; procedure Tfrm_ch_invoice.RxDBLookupCombo3KeyPress(Sender: TObject; var Key: Char); begin key_RxDBLookupCombo(Key,RxDBLookupCombo2); end; procedure Tfrm_ch_invoice.RxDBLookupCombo2KeyPress(Sender: TObject; var Key: Char); begin key_DBEdit(Key,DBEdit27); end; procedure Tfrm_ch_invoice.DE_ShipNameKeyPress(Sender: TObject; var Key: Char); begin key_DBEdit(Key,DE_BLNO); end; procedure Tfrm_ch_invoice.DE_BLNOKeyPress(Sender: TObject; var Key: Char); begin key_wwDBDateTimePicker(Key,wwDBDateTimePicker2); end; procedure Tfrm_ch_invoice.wwDBDateTimePicker2KeyPress(Sender: TObject; var Key: Char); begin key_wwDBLookupCombo(Key,wwDBLookupCombo10); end; procedure Tfrm_ch_invoice.wwDBLookupCombo11KeyPress(Sender: TObject; var Key: Char); begin key_wwDBLookupCombo(Key,wwDBLookupCombo12); end; procedure Tfrm_ch_invoice.DE_SumUpperKeyPress(Sender: TObject; var Key: Char); begin key_DBEdit(Key,DBSumLower); end; procedure Tfrm_ch_invoice.DBSumLowerKeyPress(Sender: TObject; var Key: Char); begin key_wwDBLookupCombo(Key,wwDBLookupCombo6); end; procedure Tfrm_ch_invoice.wwDBLookupCombo6KeyPress(Sender: TObject; var Key: Char); begin key_DBEdit(Key,DE_BusnessNo); end; procedure Tfrm_ch_invoice.DE_BusnessNoKeyPress(Sender: TObject; var Key: Char); begin key_DBEdit(Key,DE_TaxNo); end; procedure Tfrm_ch_invoice.DE_TaxNoKeyPress(Sender: TObject; var Key: Char); begin key_DBEdit(Key,DE_Maker); end; procedure Tfrm_ch_invoice.DE_MakerKeyPress(Sender: TObject; var Key: Char); begin key_wwDBLookupCombo(Key,wwDBLookupCombo7); end; procedure Tfrm_ch_invoice.RxDBLookupCombo3Change(Sender: TObject); begin if t_ch_invoice.fieldbyname('发票类别').asstring='自由发票'then begin if (t_ch_invoice.state=dsinsert)or(t_ch_invoice.state=dsedit)then begin if not frm_data_share.t_crm_client_all.IsEmpty then if frm_data_share.t_crm_client_all.locate('客户简称',RxDBLookupCombo3.DisplayValues[1],[]) then begin if frm_data_share.t_crm_client_all.fieldbyname('发票抬头').asstring<>'' then t_ch_invoice['发票抬头']:=frm_data_share.t_crm_client_all.fieldbyname('发票抬头').asstring else t_ch_invoice['发票抬头']:=frm_data_share.t_crm_client_all.fieldbyname('客户全称').asstring; t_ch_invoice['纳税人识别号']:=frm_data_share.t_crm_client_all.fieldbyname('纳税人识别号').asstring; t_ch_invoice['地址电话']:=frm_data_share.t_crm_client_all.fieldbyname('通讯地址').asstring+frm_data_share.t_crm_client_all.fieldbyname('电话').asstring; t_ch_invoice['开户行及账号']:=frm_data_share.t_crm_client_all.fieldbyname('开户行RMB').asstring+frm_data_share.t_crm_client_all.fieldbyname('帐号RMB').asstring +frm_data_share.t_crm_client_all.fieldbyname('开户行USD').asstring+frm_data_share.t_crm_client_all.fieldbyname('帐号USD').asstring; t_ch_invoice['纳税类型']:=frm_data_share.t_crm_client_all.fieldbyname('纳税类型').asstring; end; end; end; end; procedure Tfrm_ch_invoice.bsSkinButton10Click(Sender: TObject); begin try frm_ch_invoice_query:=tfrm_ch_invoice_query.Create (self); frm_ch_invoice_query.shen_query_limited:='1001'; frm_ch_invoice_query.ShowModal; finally frm_ch_invoice_query.Free; end; end; procedure Tfrm_ch_invoice.N10Click(Sender: TObject); begin if bsSkinTabSheet1.Showing then update_grid_view_no(dxdbgrid1) else update_grid_view_no(dxdbgrid2); end; procedure Tfrm_ch_invoice.N14Click(Sender: TObject); begin if bsSkinTabSheet1.Showing then update_grid_view_all(dxdbgrid1) else update_grid_view_all(dxdbgrid2); end; procedure Tfrm_ch_invoice.N12Click(Sender: TObject); begin if bsSkinTabSheet1.Showing then update_grid(dxdbgrid1,7) else update_grid(dxdbgrid2,8); end; procedure Tfrm_ch_invoice.N16Click(Sender: TObject); begin if bsSkinTabSheet1.Showing then grid_save_xls(dxdbgrid1) else grid_save_xls(dxdbgrid2); end; procedure Tfrm_ch_invoice.dxDBGrid1ColumnSorting(Sender: TObject; Column: TdxDBTreeListColumn; var Allow: Boolean); begin Column_sort(Column,t_ch_invoice,'发票号码'); end; procedure Tfrm_ch_invoice.dxDBGrid2ColumnSorting(Sender: TObject; Column: TdxDBTreeListColumn; var Allow: Boolean); begin Column_sort(Column,t_ch_invoice_shen,'申请编号'); end; procedure Tfrm_ch_invoice.bsSkinButton22Click(Sender: TObject); begin shen_modify_ok(t_ch_invoice_shen); end; procedure Tfrm_ch_invoice.bsSkinButton27Click(Sender: TObject); begin shen_modify_back(t_ch_invoice_shen); end; procedure Tfrm_ch_invoice.bsSkinButton32Click(Sender: TObject); var Pnt:Tpoint; begin Pnt:=bsSkinButton32.ClientToScreen(Point(0,bsSkinButton32.Height)); PopupMenu3.Popup(Pnt.x,Pnt.y); end; procedure Tfrm_ch_invoice.N17Click(Sender: TObject); begin t_ch_invoice_shen.Close; t_ch_invoice_shen.SQL.clear; t_ch_invoice_shen.SQL.Add('select * from t_ch_invoice_shen where 申请状态 in ('+''''+'申请开票'+'''' +') ' +' and '+open_data('1001','申请人','no','no','no','no') +' order by 申请编号 desc'); t_ch_invoice_shen.open; t_ch_invoice_shen_item.Close; t_ch_invoice_shen_item.open; end; procedure Tfrm_ch_invoice.N34Click(Sender: TObject); begin t_ch_invoice_shen.Close; t_ch_invoice_shen.SQL.clear; t_ch_invoice_shen.SQL.Add('select * from t_ch_invoice_shen where 申请状态 in ('+''''+'驳回申请'+'''' +','+''''+'禁止修改'+''''+') ' +' and '+open_data('1001','申请人','no','no','no','no') +' order by 申请编号 desc'); t_ch_invoice_shen.open; t_ch_invoice_shen_item.Close; t_ch_invoice_shen_item.open; end; procedure Tfrm_ch_invoice.N36Click(Sender: TObject); begin t_ch_invoice_shen.Close; t_ch_invoice_shen.SQL.clear; t_ch_invoice_shen.SQL.Add('select * from t_ch_invoice_shen where 申请状态 in (' +''''+'提交申请'+''''+','+''''+'申请修改'+''''+') ' +' and '+open_data('1001','申请人','no','no','no','no') +' order by 申请编号 desc'); t_ch_invoice_shen.open; t_ch_invoice_shen_item.Close; t_ch_invoice_shen_item.open; end; procedure Tfrm_ch_invoice.N6Click(Sender: TObject); begin t_ch_invoice_shen.Close; t_ch_invoice_shen.SQL.clear; t_ch_invoice_shen.SQL.Add('select * from t_ch_invoice_shen where 申请状态 in ('+''''+'批准开票'+'''' +','+''''+'禁止修改'+''''+') ' +' and '+open_data('1001','申请人','no','no','no','no') +' order by 申请编号 desc'); t_ch_invoice_shen.open; t_ch_invoice_shen_item.Close; t_ch_invoice_shen_item.open; end; procedure Tfrm_ch_invoice.MenuItem2Click(Sender: TObject); begin t_ch_invoice_shen.Close; t_ch_invoice_shen.SQL.clear; t_ch_invoice_shen.SQL.Add('select * from t_ch_invoice_shen where 申请状态 in ('+''''+'开出发票'+''''+') ' +' and '+open_data('1001','申请人','no','no','no','no') +' order by 申请编号 desc'); t_ch_invoice_shen.open; t_ch_invoice_shen_item.Close; t_ch_invoice_shen_item.open; end; procedure Tfrm_ch_invoice.dxDBGridMaskColumn2CustomDraw(Sender: TObject; ACanvas: TCanvas; ARect: TRect; ANode: TdxTreeListNode; AColumn: TdxDBTreeListColumn; const AText: String; AFont: TFont; var AColor: TColor; ASelected, AFocused: Boolean; var ADone: Boolean); begin if (ANode.strings[dxDBGridMaskColumn2.Index]='申请开票')or (ANode.strings[dxDBGridMaskColumn2.Index]='批准修改') then AColor :=clwhite else if (ANode.strings[dxDBGridMaskColumn2.Index]='提交申请')or (ANode.strings[dxDBGridMaskColumn2.Index]='申请修改') then AColor :=clyellow else if (ANode.strings[dxDBGridMaskColumn2.Index]='禁止修改')or (ANode.strings[dxDBGridMaskColumn2.Index]='驳回申请')then AColor :=clred else if (ANode.strings[dxDBGridMaskColumn2.Index]='批准开票')or (ANode.strings[dxDBGridMaskColumn2.Index]='开出发票') then AColor :=$00DDF21C; AFont.Color:=clblack; end; procedure Tfrm_ch_invoice.DBEdit1Change(Sender: TObject); begin if (DBEdit1.Text='') or (DBEdit1.Text='申请开票') or (DBEdit1.Text='批准修改')then DBEdit1.Color:=clwhite else if (DBEdit1.Text='提交申请') or (DBEdit1.Text='申请修改') then DBEdit1.Color:=clyellow else if (DBEdit1.Text='禁止修改') or (DBEdit1.Text='驳回申请') then DBEdit1.Color:=clred else if (DBEdit1.Text='批准开票') or (DBEdit1.Text='开出发票') then DBEdit1.Color:=$00DDF21C; end; procedure Tfrm_ch_invoice.DBEdit29KeyPress(Sender: TObject; var Key: Char); begin key_DBEdit(Key,DE_ShipName); end; procedure Tfrm_ch_invoice.wwDBDateTimePicker1KeyPress(Sender: TObject; var Key: Char); begin key_DBEdit(Key,DBEdit29); end; procedure Tfrm_ch_invoice.wwDBLookupCombo1KeyPress(Sender: TObject; var Key: Char); begin // key_wwDBDateTimePicker(Key,wwDBDateTimePicker1); end; procedure Tfrm_ch_invoice.DBEdit27KeyPress(Sender: TObject; var Key: Char); begin key_wwDBLookupCombo(Key,wwDBLookupCombo1); end; procedure Tfrm_ch_invoice.t_ch_invoiceAfterPost(DataSet: TDataSet); var aAdoQuery:TAdoQuery; FeeList,AmtList:TStringList; i:Integer; Amt :Double; begin // t_ch_invoice_head.Requery(); if t_ch_invoice['发票类别']<>'申请发票' then begin if bsSkinPageControl1.ActivePage=bsSkinTabSheet3 then begin ADOQuery1.Requery; ADOQuery2.Requery; ADOQuery3.Requery; ADOQuery4.Requery; end; if StrToBool(get_parameters_value(85,'false')) then begin if (bsSkinPageControl6.ActivePage=bstab2) then begin if fra_ch_delete_do1.v_fee_do_bscard_sum.active then begin fra_ch_delete_do1.v_fee_do_bscard_sum.Requery; fra_ch_delete_do1.v_fee_do_bscard.Requery; end; end; end else begin if (bsSkinPageControl6.ActivePage=bstab2) then begin if fra_ch_delete_do1.v_fee_do_seae.active then begin fra_ch_delete_do1.v_fee_do_seae.Requery; fra_ch_delete_do1.v_fee_do_seae_sum.Requery; fra_ch_delete_do1.v_fee_do_seai.Requery; fra_ch_delete_do1.v_fee_do_seai_sum.Requery; fra_ch_delete_do1.v_fee_do_aire.Requery; fra_ch_delete_do1.v_fee_do_aire_sum.Requery; fra_ch_delete_do1.v_fee_do_airi.Requery; fra_ch_delete_do1.v_fee_do_airi_sum.Requery; end; end; end; if if_ch_delete_do then begin case delete_do_type_num of 1,2,3,4,5: begin if fra_ch_add_do1.t_op_seae.Active then begin fra_ch_add_do1.t_ch_fee.Requery(); fra_ch_add_do1.t_ch_fee_sum.Requery(); end; end; end; end; delete_do_type_num:=0; if_ch_delete_do:=false; end; aAdoQuery:=CreateAdoQuery; with aAdoQuery do try Close;SQL.Clear; SQL.Add('Update t_ch_invoice_item set 备注=:备注'); SQL.Add('where IN_ID=:IN_ID'); Parameters.ParamByName('IN_ID').Value:=t_ch_invoice.FieldByName('IN_ID').AsInteger; Parameters.ParamByName('备注').Value:=t_ch_invoice.FieldByName('备注').asString; ExecSQL; finally Free; end; { with t_ch_invoice_item do try t_ch_invoice_item.DisableControls; first; while not eof do begin edit; fieldbyname('备注').AsString:=t_ch_invoice.FieldByName('备注').asString; post; next; end; finally t_ch_invoice_item.EnableControls; end; } if t_ch_invoice_item.active then begin t_ch_invoice_item.Requery; end else begin t_ch_invoice_item.Open; t_ch_invoice_item.Requery; end; { FeeList:=TStringList.Create; FeeList.Clear; AmtList:=TStringList.Create; AmtList.Clear; FeeList.Text:=Trim(t_ch_invoice.FieldByName('费用列表').AsString); AmtList.Text:=Trim(t_ch_invoice.FieldByName('金额列表').AsString); if FeeList.Count=AmtList.Count then begin if (FeeList.Count>=1) and (AmtList.Count>=1) then begin aAdoQuery:=CreateAdoQuery; with aAdoQuery do try Close;sql.Clear; SQL.Add('Delete from t_ch_invoice_item'); SQL.Add('where IN_ID=:IN_ID'); Parameters.ParamByName('IN_ID').Value:=t_ch_invoice.FieldByName('IN_ID').asinteger; ExecSQL; if FeeList.Count>=1 then begin for i :=0 to FeeList.Count-1 do begin Amt:=0; Close;sql.Clear; SQL.Add('Insert into t_ch_invoice_item ( IN_ID, 商品名称, 规格型号, 计量单位, 数量, 单价, 金额, 税率 ,税额 ,折扣,备注,含税价标志 )'); SQL.Add('values (:IN_ID,:商品名称,:规格型号,:计量单位,:数量,:单价,:金额, :税率,:税额,:折扣,:备注,:含税价标志)'); Parameters.ParamByName('IN_ID').Value:=t_ch_invoice.FieldByName('IN_ID').asinteger; if pos('代理',FeeList[i])>0 then Parameters.ParamByName('商品名称').Value:=FeeList[i] else Parameters.ParamByName('商品名称').Value:='代理'+FeeList[i]; Parameters.ParamByName('规格型号').Value:='0'; Parameters.ParamByName('计量单位').Value:='票'; Parameters.ParamByName('数量').Value:=1; Amt:=StrToFloat(AmtList[i]); Parameters.ParamByName('税额').Value:=(Amt/(1+frm_data_share.t_sys_company.fieldbyname('税率').AsFloat/100))*frm_data_share.t_sys_company.fieldbyname('税率').AsFloat/100; Parameters.ParamByName('单价').Value:=Amt-Parameters.ParamByName('税额').Value; Parameters.ParamByName('金额').Value:=Amt-Parameters.ParamByName('税额').Value; Parameters.ParamByName('税率').Value:=frm_data_share.t_sys_company.fieldbyname('税率').AsFloat/100; Parameters.ParamByName('折扣').Value:=0; Parameters.ParamByName('备注').Value:=t_ch_invoice.FieldByName('备注').asString; Parameters.ParamByName('含税价标志').Value:=0; ExecSQL; end; end; finally Free; end; end; end else begin ShowMessage('费用条目不等于金额条目'); end; try finally FeeList.Free; AmtList.Free; end; } end; procedure Tfrm_ch_invoice.N8Click(Sender: TObject); var aQuery:TADOQuery; begin // aQuery:=CreateAdoQuery; try modify_all:=true; t_ch_invoice.edit; t_ch_invoice['是否收费']:=1; t_ch_invoice.post; { with aQuery do begin Close;SQL.Clear; SQL.Add('Update t_ch_invoice set 是否收费=1 where IN_ID='+inttostr(t_ch_invoice.fieldbyName('IN_ID').AsInteger)); ExecSQL; end; t_ch_invoice.Refresh; } finally modify_all:=false; // FreeAndNil(aQuery); end; end; procedure Tfrm_ch_invoice.N19Click(Sender: TObject); begin // aQuery:=CreateAdoQuery; try modify_all:=true; t_ch_invoice.edit; t_ch_invoice['是否收费']:=0; t_ch_invoice.post; { with aQuery do begin Close;SQL.Clear; SQL.Add('Update t_ch_invoice set 是否收费=0 where IN_ID='+inttostr(t_ch_invoice.fieldbyName('IN_ID').AsInteger)); ExecSQL; end; t_ch_invoice.Refresh; } finally modify_all:=false; // FreeAndNil(aQuery); end; end; procedure Tfrm_ch_invoice.DBEdit12Change(Sender: TObject); begin if DBEdit12.Text<>'申请发票' then bstab2.TabVisible:=True else bstab2.TabVisible:=false; end; procedure Tfrm_ch_invoice.DE_BLNODblClick(Sender: TObject); var str:String; begin //双击主提单号添加发票明细 frmch_invoice_addone:=Tfrmch_invoice_addone.Create(Self); try with frmch_invoice_addone.ADOQuery1 do begin frmch_invoice_addone.MblNo:=true; frmch_invoice_addone.ADOQuery2.Close; frmch_invoice_addone.ADOQuery2.SQL.Clear; frmch_invoice_addone.ADOQuery2.SQL.Add('select 主提单号,委托编号,船名,航次,开船日期,起运港,卸货港,目的地 from v_op_bscard where 主提单号='''+Trim(DE_BLNO.Text)+''' or 分提单号='''+Trim(DE_BLNO.Text)+''''); frmch_invoice_addone.ADOQuery2.Open; str:=' and 金额<>(开票金额+申请开票) and 不开发票<>1 and 类型=''收'' and 编号 in (select 编号 from v_op_bscard where 主提单号='''+Trim(DE_BLNO.Text)+''' or 分提单号='''+Trim(DE_BLNO.Text)+''')'; frmch_invoice_addone.t_fee_obj.Close; frmch_invoice_addone.t_fee_obj.SQL.Clear; frmch_invoice_addone.t_fee_obj.SQL.Add('Select distinct 客户名称 from t_ch_fee where 1=1 ') ; frmch_invoice_addone.t_fee_obj.SQL.Add(str); if t_ch_invoice.FieldByName('客户名称').AsString<>'' then frmch_invoice_addone.t_fee_obj.SQL.Add(' and 客户名称='''+t_ch_invoice.FieldByName('客户名称').AsString+''''); frmch_invoice_addone.t_fee_obj.Open; Close; SQL.Clear; SQL.Add('Select * from t_ch_fee where 1=1 '); if t_ch_invoice.FieldByName('客户名称').AsString<>'' then SQL.Add(' and 客户名称='''+t_ch_invoice.FieldByName('客户名称').AsString+''''); // else // SQL.Add(' and 客户名称=:客户名称 '); SQL.Add(str); Open; if not IsEmpty then begin if t_ch_invoice.FieldByName('币别').AsString='USD' then frmch_invoice_addone.bsSkinRadioGroup1.ItemIndex:=1 else frmch_invoice_addone.bsSkinRadioGroup1.ItemIndex:=0; frmch_invoice_addone.ShowModal; end else begin MessageDlg('此主提单号下此客户无应开发票的费用',mtWarning,[mbYes],0); end; end; finally t_ch_invoice_item.Requery(); FreeAndNil(frmch_invoice_addone); end; end; procedure Tfrm_ch_invoice.DBEdit29DblClick(Sender: TObject); var str:String; begin //双击委托编号添加发票明细 frmch_invoice_addone:=Tfrmch_invoice_addone.Create(Self); try with frmch_invoice_addone.ADOQuery1 do begin frmch_invoice_addone.MblNo:=false; frmch_invoice_addone.ADOQuery2.Close; frmch_invoice_addone.ADOQuery2.SQL.Clear; frmch_invoice_addone.ADOQuery2.SQL.Add('select 主提单号,委托编号,船名,航次,开船日期,起运港,卸货港,目的地 from v_op_bscard where 委托编号='''+Trim(DBEdit29.Text)+''' or 业务编号='''+Trim(DBEdit29.Text)+''' or 分提单号='''+Trim(DBEdit29.Text)+''''); frmch_invoice_addone.ADOQuery2.Open; str:=' and 金额<>(开票金额+申请开票) and 不开发票<>1 and 类型=''收'' and 编号 in (select 编号 from v_op_bscard where 委托编号='''+Trim(DBEdit29.Text)+''' or 业务编号='''+Trim(DBEdit29.Text)+''' or 分提单号='''+Trim(DBEdit29.Text)+''')'; frmch_invoice_addone.t_fee_obj.Close; frmch_invoice_addone.t_fee_obj.SQL.Clear; frmch_invoice_addone.t_fee_obj.SQL.Add('Select distinct 客户名称 from t_ch_fee where 1=1 ') ; frmch_invoice_addone.t_fee_obj.SQL.Add(str); if t_ch_invoice.FieldByName('客户名称').AsString<>'' then frmch_invoice_addone.t_fee_obj.SQL.Add(' and 客户名称='''+t_ch_invoice.FieldByName('客户名称').AsString+''''); frmch_invoice_addone.t_fee_obj.Open; Close; SQL.Clear; SQL.Add('Select * from t_ch_fee where 1=1 '); if t_ch_invoice.FieldByName('客户名称').AsString<>'' then SQL.Add(' and 客户名称='''+t_ch_invoice.FieldByName('客户名称').AsString+''''); // else // SQL.Add(' and 客户名称=:客户名称 '); SQL.Add(str); Open; // frmch_invoice_addone.memtblDetail.open; if not IsEmpty then begin if t_ch_invoice.FieldByName('币别').AsString='USD' then frmch_invoice_addone.bsSkinRadioGroup1.ItemIndex:=1 else frmch_invoice_addone.bsSkinRadioGroup1.ItemIndex:=0; frmch_invoice_addone.ShowModal; end else begin MessageDlg('此委托编号下此客户无应开发票的费用',mtWarning,[mbYes],0); end; end; finally t_ch_invoice_item.Requery(); FreeAndNil(frmch_invoice_addone); end; end; procedure Tfrm_ch_invoice.t_ch_invoiceAfterScroll(DataSet: TDataSet); begin { if t_ch_invoice['是否废除'] then begin if t_ch_invoice['是否打印'] then begin bsSkinButton7.Caption:='删除发票'; bsSkinButton12.Caption:='删除发票'; end else begin bsSkinButton7.Caption:='废除发票'; bsSkinButton12.Caption:='废除发票'; end; end; } end; procedure Tfrm_ch_invoice.t_ch_invoice1DataChange(Sender: TObject; Field: TField); begin if t_ch_invoice.State in [dsinsert] then exit; if t_ch_invoice.IsEmpty then exit; if t_ch_invoice['是否打印'] then begin if t_ch_invoice.fieldbyname('是否废除').asboolean then begin bsSkinButton7.Caption:='撤销废除'; bsSkinButton12.Caption:='撤销废除'; end else begin bsSkinButton7.Caption:='废除发票'; bsSkinButton12.Caption:='废除发票'; end; end else begin bsSkinButton7.Caption:='删除发票'; bsSkinButton12.Caption:='删除发票'; end; end; procedure Tfrm_ch_invoice.ComboBoxObjBsCardDropDown(Sender: TObject); var aQuery:TADOQuery; begin ComboBoxObjBsCard.Items.Clear; aQuery:=CreateAdoQuery; with aQuery do try Close;SQL.Clear; SQL.Add('select distinct 发票抬头 from t_ch_invoice'); SQL.Add('order by 发票抬头'); Open; First; while not Eof do begin ComboBoxObjBsCard.Items.Add(FieldByName('发票抬头').AsString); Next; end; finally Close; FreeAndNil(aQuery); end; end; procedure Tfrm_ch_invoice.ComboBoxObjBsCardKeyPress(Sender: TObject; var Key: Char); begin // key_wwDBDateTimePicker(Key,wwDBDateTimePicker1); end; procedure Tfrm_ch_invoice.dbedt1KeyPress(Sender: TObject; var Key: Char); begin if key=#13 then DBComboBoxEh1.Text:=dbedt1.text; DBComboBoxEh1.DropDown; // ComboBoxObjBsCard.DropDown; // key_wwDBDateTimePicker(Key,wwDBDateTimePicker1); end; procedure Tfrm_ch_invoice.DBEdit30Change(Sender: TObject); begin if DBEdit30.Text='' then begin t_sys_bank.Filtered:=false; end else begin t_sys_bank.Filtered:=false; t_sys_bank.Filter:='分部名称='''+DBEdit30.text+''''; t_sys_bank.Filtered:=true; if t_sys_bank.IsEmpty then t_sys_bank.Filtered:=false; end; end; procedure Tfrm_ch_invoice.RxDBLookupCombo2Enter(Sender: TObject); begin DBEdit30Change(sender); end; procedure Tfrm_ch_invoice.bsSkinButton38Click(Sender: TObject); var book1:Tbookmark; begin book1:=t_ch_invoice.GetBookmark; t_ch_invoice.Requery; t_ch_invoice.GotoBookmark(book1); end; procedure Tfrm_ch_invoice.bsSkinButton33Click(Sender: TObject); var book1:Tbookmark; begin book1:=t_ch_invoice_shen.GetBookmark; t_ch_invoice_shen.Requery; t_ch_invoice_shen.GotoBookmark(book1); end; procedure Tfrm_ch_invoice.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 ANode.Strings[dxDBGrid1Column29.Index]='True' then begin AFont.Style:=AFont.Style+[fsStrikeOut]; AFont.Color:=clred; end; if ANode.Strings[dxDBGrid1Column38.Index]='True' then begin if frm_data_share.t_code_fee_color.Locate('费用状态','审核通过',[])then begin aColor:=StringToColor(frm_data_share.t_code_fee_color.fieldbyname('颜色').asstring); end; end; end; procedure Tfrm_ch_invoice.wwDBLookupCombo6Change(Sender: TObject); VAR total_money:real; currency_chi:string; begin //币别更改 try if (t_ch_invoice.state=dsinsert) or (t_ch_invoice.state=dsedit) then begin if frm_data_share.t_code_currency.Locate('币别',wwDBLookupCombo6.text,[])then currency_chi:=frm_data_share.t_code_currency.fieldbyname('中文名').asstring; total_money:=strtofloat(DBSumLower.text); if total_money<0 then begin total_money:=Abs(total_money); t_ch_invoice['金额大写']:=invoice_max(total_money,currency_chi+'(付)'); end else t_ch_invoice['金额大写']:=invoice_max(total_money,currency_chi); end; if t_sys_bank.Active then if t_sys_bank.Locate('币别',wwDBLookupCombo6.text,[])then begin t_ch_invoice['开户银行']:=t_sys_bank.fieldbyname('银行名称').asstring; t_ch_invoice['银行账号']:=t_sys_bank.fieldbyname('银行账号').asstring; end; except ; end; end; procedure Tfrm_ch_invoice.DBComboBoxEh1DropDown(Sender: TObject); var aQuery:TADOQuery; begin DBComboBoxEh1.Items.Clear; aQuery:=CreateAdoQuery; with aQuery do try Close;SQL.Clear; SQL.Add('select 发票抬头,纳税人识别号,地址电话,开户行及帐号 from t_crm_client_Invoice'); SQL.Add('Where 客户简称=:客户简称'); Parameters.ParamByName('客户简称').Value:=t_ch_invoice.FieldByName('客户名称').AsString; open; if not IsEmpty then begin while not eof do begin DBComboBoxEh1.Items.Add(fieldbyname('发票抬头').asstring); Next; end; end else begin Close;SQL.Clear; SQL.Add('select distinct 发票抬头 from t_ch_invoice'); SQL.Add('where 发票抬头<>'''''); Open;First; while not eof do begin DBComboBoxEh1.Items.Add(fieldbyname('发票抬头').asstring); Next; end; end; finally Close; FreeAndNil(aQuery); end; end; procedure Tfrm_ch_invoice.dbedt1Change(Sender: TObject); begin // DBComboBoxEh1.Text:=dbedt1.text; end; procedure Tfrm_ch_invoice.DBComboBoxEh1CloseUp(Sender: TObject; Accept: Boolean); begin DBComboBoxEh1.items.Clear; end; procedure Tfrm_ch_invoice.bsSkinPageControl1Change(Sender: TObject); begin if not ch_invoice_open then exit; if bsSkinPageControl1.ActivePage=bsSkinTabSheet3 then begin if strtobool(get_parameters_value(1,'false'))then begin if not t_ch_invoice_shen.Active then begin t_ch_invoice_shen.close; t_ch_invoice_shen.sql.clear; t_ch_invoice_shen.sql.add('select * from t_ch_invoice_shen '); t_ch_invoice_shen.sql.add('where 申请状态 in ('+''''+'批准开票'+''''+','+''''+'禁止修改'+''''+','+''''+'申请修改'+'''' +','+''''+'提交申请'+''''+')'); t_ch_invoice_shen.sql.add('and '+open_data('1001','申请人','no','no','no','no')); t_ch_invoice_shen.sql.add(' order by 申请编号'); t_ch_invoice_shen.open; t_ch_invoice_shen_item.Close; t_ch_invoice_shen_item.open; end; end else begin if not t_ch_invoice_shen.Active then begin t_ch_invoice_shen.close; t_ch_invoice_shen.sql.clear; t_ch_invoice_shen.sql.add('select * from t_ch_invoice_shen '); t_ch_invoice_shen.sql.add('where 申请状态 in ('+''''+'批准开票'+''''+','+''''+'禁止修改'+''''+','+''''+'申请修改'+'''' +','+''''+'提交申请'+''''+')'); t_ch_invoice_shen.sql.add('and '+open_data('1001','申请人','no','no','no','no')); t_ch_invoice_shen.sql.add(' order by 申请编号'); t_ch_invoice_shen.Open; t_ch_invoice_shen_item.Close; t_ch_invoice_shen_item.open; end; end; end; if bsSkinPageControl2.ActivePage=bsSkinTabSheet22 then begin if StrToBool(get_parameters_value(85,'false')) then begin bsSkinTabSheet4.TabVisible:=false; bsSkinTabSheet5.TabVisible:=false; bsSkinTabSheet6.TabVisible:=false; bsSkinTabSheet7.TabVisible:=false; bsSkinTabSheet14.TabVisible:=true; v_fee_do_bscard.Close; v_fee_do_bscard.DataSource:=t_ch_invoice_shen1; v_fee_do_bscard.Open; v_fee_do_seae.Close; v_fee_do_seai.Close; v_fee_do_aire.Close; v_fee_do_airi.Close; end else begin bsSkinTabSheet4.TabVisible:=true; bsSkinTabSheet5.TabVisible:=true; bsSkinTabSheet6.TabVisible:=true; bsSkinTabSheet7.TabVisible:=true; bsSkinTabSheet14.TabVisible:=false; v_fee_do_seae.open; v_fee_do_seai.open; v_fee_do_aire.open; v_fee_do_airi.open; v_fee_do_bscard.Close; end; end; if bsSkinPageControl1.ActivePage=bsSkinTabSheet2 then begin if StrToBool(get_parameters_value(85,'false')) then begin bsSkinTabSheet8.TabVisible:=false; bsSkinTabSheet9.TabVisible:=false; bsSkinTabSheet10.TabVisible:=false; bsSkinTabSheet12.TabVisible:=false; bsSkinTabSheet13.TabVisible:=true; v_fee_do_bscard.Close; v_fee_do_bscard.DataSource:=t_ch_invoice1; v_fee_do_bscard.Open; ADOQuery1.Close; ADOQuery2.Close; ADOQuery3.Close; ADOQuery4.Close; end else begin bsSkinTabSheet8.TabVisible:=true; bsSkinTabSheet9.TabVisible:=true; bsSkinTabSheet10.TabVisible:=true; bsSkinTabSheet12.TabVisible:=true; bsSkinTabSheet13.TabVisible:=false; ADOQuery1.open; ADOQuery2.open; ADOQuery3.open; ADOQuery4.open; v_fee_do_bscard.Close; end; end; end; procedure Tfrm_ch_invoice.bsSkinPageControl6Change(Sender: TObject); begin if not ch_invoice_open then exit; if not (bsSkinPageControl6.ActivePage=bstab2) then exit; if StrToBool(get_parameters_value(85,'false')) then begin fra_ch_delete_do1.v_fee_do_bscard.close; fra_ch_delete_do1.v_fee_do_bscard.SQL.clear; fra_ch_delete_do1.v_fee_do_bscard.sql.add('select * from v_fee_do_bscard ' +'where 工作编号='''+t_ch_invoice.fieldbyname('申请编号').AsString+''' order by 类型,编号,费用名称'); // fra_ch_delete_do1.v_fee_do_bscard.DataSource:=t_ch_invoice1; fra_ch_delete_do1.v_fee_do_bscard.Open; fra_ch_delete_do1.v_fee_do_bscard_sum.close; fra_ch_delete_do1.v_fee_do_bscard_sum.SQL.clear; fra_ch_delete_do1.v_fee_do_bscard_sum.sql.add('select 类型,SUBSTRING(CONVERT(char(15),开船日期,111),1,7) AS 月份,揽货人,原始币别,sum(原始金额) as 原始金额,sum(金额) as 金额 from v_fee_do_bscard ' +'where 工作编号='''+t_ch_invoice.fieldbyname('申请编号').AsString+''' group by 类型,SUBSTRING(CONVERT(char(15),开船日期,111),1,7),揽货人,原始币别 ' +'order by 类型,揽货人,SUBSTRING(CONVERT(char(15),开船日期,111),1,7),原始币别'); // fra_ch_delete_do1.v_fee_do_bscard_sum.DataSource:=t_ch_invoice1; fra_ch_delete_do1.v_fee_do_bscard_sum.Open; end else begin fra_ch_delete_do1.v_fee_do_seae.close; fra_ch_delete_do1.v_fee_do_seae.SQL.clear; fra_ch_delete_do1.v_fee_do_seae.sql.add('select * from v_fee_do_seae ' +'where 工作编号='''+t_ch_invoice.fieldbyname('申请编号').AsString+''' order by 编号,费用名称'); // fra_ch_delete_do1.v_fee_do_seae.DataSource:=t_ch_invoice1; fra_ch_delete_do1.v_fee_do_seae.Open; fra_ch_delete_do1.v_fee_do_seai.close; fra_ch_delete_do1.v_fee_do_seai.SQL.clear; fra_ch_delete_do1.v_fee_do_seai.sql.add('select * from v_fee_do_seai ' +'where 工作编号='''+t_ch_invoice.fieldbyname('申请编号').AsString+''' order by 编号,费用名称'); // fra_ch_delete_do1.v_fee_do_seai.DataSource:=t_ch_invoice1; fra_ch_delete_do1.v_fee_do_seai.Open; fra_ch_delete_do1.v_fee_do_aire.close; fra_ch_delete_do1.v_fee_do_aire.SQL.clear; fra_ch_delete_do1.v_fee_do_aire.sql.add('select * from v_fee_do_aire ' +'where 工作编号='''+t_ch_invoice.fieldbyname('申请编号').AsString+''' order by 编号,费用名称'); // fra_ch_delete_do1.v_fee_do_aire.DataSource:=t_ch_invoice1; fra_ch_delete_do1.v_fee_do_aire.Open; fra_ch_delete_do1.v_fee_do_airi.close; fra_ch_delete_do1.v_fee_do_airi.SQL.clear; fra_ch_delete_do1.v_fee_do_airi.sql.add('select * from v_fee_do_airi ' +'where 工作编号='''+t_ch_invoice.fieldbyname('申请编号').AsString+''' order by 编号,费用名称'); // fra_ch_delete_do1.v_fee_do_airi.DataSource:=t_ch_invoice1; fra_ch_delete_do1.v_fee_do_airi.Open; fra_ch_delete_do1.v_fee_do_seae_sum.close; fra_ch_delete_do1.v_fee_do_seae_sum.SQL.clear; fra_ch_delete_do1.v_fee_do_seae_sum.sql.add('select SUBSTRING(CONVERT(char(15),开船日期,111),1,7) AS 月份,揽货人,原始币别,sum(原始金额) as 原始金额,sum(金额) as 金额 from v_fee_do_seae ' +'where 工作编号='''+t_ch_invoice.fieldbyname('申请编号').AsString+''' group by SUBSTRING(CONVERT(char(15),开船日期,111),1,7),揽货人,原始币别 ' +'order by 揽货人,SUBSTRING(CONVERT(char(15),开船日期,111),1,7),原始币别'); // fra_ch_delete_do1.v_fee_do_seae_sum.DataSource:=t_ch_invoice1; fra_ch_delete_do1.v_fee_do_seae_sum.Open; fra_ch_delete_do1.v_fee_do_seai_sum.close; fra_ch_delete_do1.v_fee_do_seai_sum.SQL.clear; fra_ch_delete_do1.v_fee_do_seai_sum.sql.add('select SUBSTRING(CONVERT(char(15),进口日期,111),1,7) AS 月份,揽货人,原始币别,sum(原始金额) as 原始金额,sum(金额) as 金额 from v_fee_do_seai ' +'where 工作编号='''+t_ch_invoice.fieldbyname('申请编号').AsString+''' group by SUBSTRING(CONVERT(char(15),进口日期,111),1,7),揽货人,原始币别 ' +'order by 揽货人,SUBSTRING(CONVERT(char(15),进口日期,111),1,7),原始币别'); // fra_ch_delete_do1.v_fee_do_seai_sum.DataSource:=t_ch_invoice1; fra_ch_delete_do1.v_fee_do_seai_sum.Open; fra_ch_delete_do1.v_fee_do_aire_sum.close; fra_ch_delete_do1.v_fee_do_aire_sum.SQL.clear; fra_ch_delete_do1.v_fee_do_aire_sum.sql.add('select SUBSTRING(CONVERT(char(15),开航日期,111),1,7) AS 月份,揽货人,原始币别,sum(原始金额) as 原始金额,sum(金额) as 金额 from v_fee_do_aire ' +'where 工作编号='''+t_ch_invoice.fieldbyname('申请编号').AsString+''' group by SUBSTRING(CONVERT(char(15),开航日期,111),1,7),揽货人,原始币别 ' +'order by 揽货人,SUBSTRING(CONVERT(char(15),开航日期,111),1,7),原始币别'); // fra_ch_delete_do1.v_fee_do_aire_sum.DataSource:=t_ch_invoice1; fra_ch_delete_do1.v_fee_do_aire_sum.Open; fra_ch_delete_do1.v_fee_do_airi_sum.close; fra_ch_delete_do1.v_fee_do_airi_sum.SQL.clear; fra_ch_delete_do1.v_fee_do_airi_sum.sql.add('select SUBSTRING(CONVERT(char(15),进口日期,111),1,7) AS 月份,揽货人,原始币别,sum(原始金额) as 原始金额,sum(金额) as 金额 from v_fee_do_airi ' +'where 工作编号='''+t_ch_invoice.fieldbyname('申请编号').AsString+''' group by SUBSTRING(CONVERT(char(15),进口日期,111),1,7),揽货人,原始币别 ' +'order by 揽货人,SUBSTRING(CONVERT(char(15),进口日期,111),1,7),原始币别'); // fra_ch_delete_do1.v_fee_do_airi_sum.DataSource:=t_ch_invoice1; fra_ch_delete_do1.v_fee_do_airi_sum.Open; end; end; procedure Tfrm_ch_invoice.dxDBGrid3Column25CustomDraw(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 AColor:=dxgrid_color_fee(ANode.strings[dxDBGrid3Column25.Index]); AFont.Color:=clblack; end; procedure Tfrm_ch_invoice.dxDBGrid4Column25CustomDraw(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 AColor:=dxgrid_color_fee(ANode.strings[dxDBGrid4Column25.Index]); AFont.Color:=clblack; end; procedure Tfrm_ch_invoice.dxDBGrid5Column22CustomDraw(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 AColor:=dxgrid_color_fee(ANode.strings[dxDBGrid5Column22.Index]); AFont.Color:=clblack; end; procedure Tfrm_ch_invoice.dxDBGrid6Column22CustomDraw(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 AColor:=dxgrid_color_fee(ANode.strings[dxDBGrid6Column22.Index]); AFont.Color:=clblack; end; procedure Tfrm_ch_invoice.dxDBGrid3Column24CustomDraw(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 AColor:=dxgrid_color('海运出口',ANode.Strings[dxDBGrid3Column24.Index]); AFont.Color:=clblack; end; procedure Tfrm_ch_invoice.dxDBGrid4Column24CustomDraw(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 AColor:=dxgrid_color('海运出口',ANode.Strings[dxDBGrid4Column24.Index]); AFont.Color:=clblack; end; procedure Tfrm_ch_invoice.dxDBGrid7Column24CustomDraw(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 AColor:=dxgrid_color('海运出口',ANode.Strings[dxDBGrid7Column24.Index]); AFont.Color:=clblack; end; procedure Tfrm_ch_invoice.dxDBGrid8Column24CustomDraw(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 AColor:=dxgrid_color('海运出口',ANode.Strings[dxDBGrid8Column24.Index]); AFont.Color:=clblack; end; procedure Tfrm_ch_invoice.dxDBGrid7Column25CustomDraw(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 AColor:=dxgrid_color_fee(ANode.strings[dxDBGrid7Column25.Index]); AFont.Color:=clblack; end; procedure Tfrm_ch_invoice.dxDBGrid8Column25CustomDraw(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 AColor:=dxgrid_color_fee(ANode.strings[dxDBGrid8Column25.Index]); AFont.Color:=clblack; end; procedure Tfrm_ch_invoice.bsSkinButton35Click(Sender: TObject); //复制到税控 begin if not if_open('602') then begin showmessage('对不起你没有此模块的操作权限,请联系系统管理员开通权限!'); exit; end; try frm_code_UsdExRate_Invoice:=tfrm_code_UsdExRate_Invoice.Create (self); frm_code_UsdExRate_Invoice.ShowModal; finally frm_code_UsdExRate_Invoice.Free; end; end; function EnumChildWindowsProc(hwnd,lparam:Integer):Boolean;stdcall; //遍历税控软件窗体 var WndClassName: array[0..254] of Char; WndCaption: array[0..254] of Char; WndLong: integer; pid,phd,maininv:thandle; p:pointer; st:TSystemTime; l:dword; nm:NMHDR; tg:tagNMDATETIMECHANGE; Mwd,Cwd: LongInt; StrNum:string; begin StrNum:='1'; GetClassName(hwnd,wndClassName,254); GetWindowText(hwnd,WndCaption,254); if get_parameters_value(155,'0')='0' then begin if invcontrid=9 then SendMessage(hwnd,WM_SETTEXT,255,Integer(PChar(frm_ch_invoice.t_ch_invoice.fieldbyname('银行账号').asstring))); if invcontrid=11 then SendMessage(hwnd,WM_SETTEXT,255,Integer(PChar(frm_ch_invoice.t_ch_invoice.fieldbyname('开户银行').asstring))); if invcontrid=13 then frm_ch_invoice.bibie:=hwnd; if invcontrid=21 then SendMessage(hwnd,WM_SETTEXT,255,Integer(PChar(frm_ch_invoice.t_ch_invoice.fieldbyname('提单号').asstring))); if invcontrid=23 then begin SendMessage(hwnd,WM_SETTEXT,255,Integer(PChar(frm_ch_invoice.t_ch_invoice.fieldbyname('目的港').asstring))); end; if invcontrid=25 then begin SendMessage(hwnd,WM_SETTEXT,255,Integer(PChar(frm_ch_invoice.t_ch_invoice.fieldbyname('卸货港').asstring))); end; if invcontrid=27 then begin SendMessage(hwnd,WM_SETTEXT,255,Integer(PChar(frm_ch_invoice.t_ch_invoice.fieldbyname('启运港').asstring))) end; if invcontrid=29 then begin SendMessage(hwnd,WM_SETTEXT,255,Integer(PChar(frm_ch_invoice.t_ch_invoice.fieldbyname('船名航次').asstring))) end; if invcontrid=31 then begin SendMessage(hwnd,WM_SETTEXT,255,Integer(PChar(frm_ch_invoice.t_ch_invoice.fieldbyname('发票抬头').asstring))) end; if (invcontrid=35) then begin frm_ch_invoice.vessldate:=hwnd; end; if (invcontrid=77) and (frm_ch_invoice.fprice1<>'') then begin SendMessage(hwnd,WM_SETTEXT,255,Integer(PChar(frm_ch_invoice.fprice1))); end; if (invcontrid=78) and (frm_ch_invoice.fprice1<>'') then begin frm_ch_invoice.feinum:=hwnd; end; if (invcontrid=80) and (frm_ch_invoice.fname1<>'') then begin SendMessage(hwnd,WM_SETTEXT,255,Integer(PChar(frm_ch_invoice.fname1))); end; if (invcontrid=73) and (frm_ch_invoice.fprice2<>'') then begin SendMessage(hwnd,WM_SETTEXT,255,Integer(PChar(frm_ch_invoice.fprice2))); end; if (invcontrid=74) and (frm_ch_invoice.fprice2<>'') then begin SendMessage(hwnd,WM_Char,Wparam('1'),1); end; if (invcontrid=82) and (frm_ch_invoice.fname2<>'') then begin SendMessage(hwnd,WM_SETTEXT,255,Integer(PChar(frm_ch_invoice.fname2))); end; if (invcontrid=70) and (frm_ch_invoice.fprice3<>'') then begin SendMessage(hwnd,WM_SETTEXT,255,Integer(PChar(frm_ch_invoice.fprice3))); end; if (invcontrid=71) and (frm_ch_invoice.fprice3<>'') then begin SendMessage(hwnd,WM_Char,Wparam('1'),1); end; if (invcontrid=84) and (frm_ch_invoice.fname3<>'') then begin SendMessage(hwnd,WM_SETTEXT,255,Integer(PChar(frm_ch_invoice.fname3))); end; if (invcontrid=67) and (frm_ch_invoice.fprice4<>'') then begin SendMessage(hwnd,WM_SETTEXT,255,Integer(PChar(frm_ch_invoice.fprice4))); end; if (invcontrid=68) and (frm_ch_invoice.fprice4<>'') then begin SendMessage(hwnd,WM_Char,Wparam('1'),1); end; if (invcontrid=86) and (frm_ch_invoice.fname4<>'') then begin SendMessage(hwnd,WM_SETTEXT,255,Integer(PChar(frm_ch_invoice.fname4))); end; if (invcontrid=64) and (frm_ch_invoice.fprice5<>'') then begin SendMessage(hwnd,WM_SETTEXT,255,Integer(PChar(frm_ch_invoice.fprice5))); end; if (invcontrid=65) and (frm_ch_invoice.fprice5<>'') then begin SendMessage(hwnd,WM_Char,Wparam('1'),1); end; if (invcontrid=88) and (frm_ch_invoice.fname5<>'') then begin SendMessage(hwnd,WM_SETTEXT,255,Integer(PChar(frm_ch_invoice.fname5))); end; if (invcontrid=48) and (frm_ch_invoice.fprice6<>'') then begin SendMessage(hwnd,WM_SETTEXT,255,Integer(PChar(frm_ch_invoice.fprice6))); end; if (invcontrid=49) and (frm_ch_invoice.fprice6<>'') then begin SendMessage(hwnd,WM_Char,Wparam('1'),1); end; if (invcontrid=90) and (frm_ch_invoice.fname6<>'') then begin SendMessage(hwnd,WM_SETTEXT,255,Integer(PChar(frm_ch_invoice.fname6))); end; if (invcontrid=45) and (frm_ch_invoice.fprice7<>'') then begin SendMessage(hwnd,WM_SETTEXT,255,Integer(PChar(frm_ch_invoice.fprice7))); end; if (invcontrid=46) and (frm_ch_invoice.fprice7<>'') then begin SendMessage(hwnd,WM_Char,Wparam('1'),1); end; if (invcontrid=92) and (frm_ch_invoice.fname7<>'') then begin SendMessage(hwnd,WM_SETTEXT,255,Integer(PChar(frm_ch_invoice.fname7))); end; if invcontrid=75 then begin SendMessage(hwnd,WM_SETTEXT,255,Integer(PChar(frm_ch_invoice.t_ch_invoice.fieldbyname('备注').asstring))) end; end else if get_parameters_value(155,'0')='1' then begin if invcontrid=24 then begin SendMessage(hwnd,WM_SETTEXT,255,Integer(PChar(frm_ch_invoice.t_ch_invoice.fieldbyname('银行账号').asstring))) end; if invcontrid=40 then begin SendMessage(hwnd,WM_SETTEXT,255,Integer(PChar(frm_ch_invoice.t_ch_invoice.fieldbyname('开户银行').asstring))) end; if invcontrid=12 then begin frm_ch_invoice.bibie:=hwnd; end; if invcontrid=16 then begin SendMessage(hwnd,WM_SETTEXT,255,Integer(PChar(frm_ch_invoice.t_ch_invoice.fieldbyname('目的港').asstring))) end; if invcontrid=18 then begin SendMessage(hwnd,WM_SETTEXT,255,Integer(PChar(frm_ch_invoice.t_ch_invoice.fieldbyname('卸货港').asstring))) end; if invcontrid=20 then begin SendMessage(hwnd,WM_SETTEXT,255,Integer(PChar(frm_ch_invoice.t_ch_invoice.fieldbyname('启运港').asstring))) end; if invcontrid=22 then begin SendMessage(hwnd,WM_SETTEXT,255,Integer(PChar(frm_ch_invoice.t_ch_invoice.fieldbyname('启运港').asstring))) end; if invcontrid=42 then begin SendMessage(hwnd,WM_SETTEXT,255,Integer(PChar(frm_ch_invoice.t_ch_invoice.fieldbyname('船名航次').asstring))) end; if invcontrid=26 then begin SendMessage(hwnd,WM_SETTEXT,255,Integer(PChar(frm_ch_invoice.t_ch_invoice.fieldbyname('发票抬头').asstring))) end; if (invcontrid=33) then begin frm_ch_invoice.vessldate:=hwnd; end; if (invcontrid=103) and (frm_ch_invoice.fprice1<>'') then begin SendMessage(hwnd,WM_SETTEXT,255,Integer(PChar(frm_ch_invoice.fprice1))); end; if (invcontrid=104) and (frm_ch_invoice.fprice1<>'') then begin SendMessage(hwnd,WM_SETTEXT,255,Integer(PChar(inttostr(1)))) end; if (invcontrid=105) and (frm_ch_invoice.fprice1<>'') then begin frm_ch_invoice.feinum:=hwnd; // SendMessage(hwnd,WM_SETTEXT,255,Integer(PChar(inttostr(1)))) end; if (invcontrid=108) and (frm_ch_invoice.fname1<>'') then begin SendMessage(hwnd,WM_SETTEXT,255,Integer(PChar(frm_ch_invoice.fname1))); end; if (invcontrid=98) and (frm_ch_invoice.fprice2<>'') then begin SendMessage(hwnd,WM_SETTEXT,255,Integer(PChar(frm_ch_invoice.fprice2))); end; if (invcontrid=99) and (frm_ch_invoice.fprice2<>'') then begin SendMessage(hwnd,WM_SETTEXT,255,Integer(PChar(inttostr(1)))) end; if (invcontrid=100) and (frm_ch_invoice.fprice2<>'') then begin SendMessage(hwnd,WM_SETTEXT,255,Integer(PChar(inttostr(1)))) end; if (invcontrid=55) and (frm_ch_invoice.fname2<>'') then begin SendMessage(hwnd,WM_SETTEXT,255,Integer(PChar(frm_ch_invoice.fname2))); end; if (invcontrid=94) and (frm_ch_invoice.fprice3<>'') then begin SendMessage(hwnd,WM_SETTEXT,255,Integer(PChar(frm_ch_invoice.fprice3))); end; if (invcontrid=95) and (frm_ch_invoice.fprice3<>'') then begin SendMessage(hwnd,WM_SETTEXT,255,Integer(PChar(inttostr(1)))) end; if (invcontrid=96) and (frm_ch_invoice.fprice3<>'') then begin SendMessage(hwnd,WM_SETTEXT,255,Integer(PChar(inttostr(1)))) end; if (invcontrid=53) and (frm_ch_invoice.fname3<>'') then begin SendMessage(hwnd,WM_SETTEXT,255,Integer(PChar(frm_ch_invoice.fname3))); end; if (invcontrid=90) and (frm_ch_invoice.fprice4<>'') then begin SendMessage(hwnd,WM_SETTEXT,255,Integer(PChar(frm_ch_invoice.fprice4))); end; if (invcontrid=91) and (frm_ch_invoice.fprice4<>'') then begin SendMessage(hwnd,WM_SETTEXT,255,Integer(PChar(inttostr(1)))) end; if (invcontrid=92) and (frm_ch_invoice.fprice4<>'') then begin SendMessage(hwnd,WM_SETTEXT,255,Integer(PChar(inttostr(1)))) end; if (invcontrid=51) and (frm_ch_invoice.fname4<>'') then begin SendMessage(hwnd,WM_SETTEXT,255,Integer(PChar(frm_ch_invoice.fname4))); end; if (invcontrid=86) and (frm_ch_invoice.fprice5<>'') then begin SendMessage(hwnd,WM_SETTEXT,255,Integer(PChar(frm_ch_invoice.fprice5))); end; if (invcontrid=87) and (frm_ch_invoice.fprice5<>'') then begin SendMessage(hwnd,WM_SETTEXT,255,Integer(PChar(inttostr(1)))) end; if (invcontrid=88) and (frm_ch_invoice.fprice5<>'') then begin SendMessage(hwnd,WM_SETTEXT,255,Integer(PChar(inttostr(1)))) end; if (invcontrid=49) and (frm_ch_invoice.fname5<>'') then begin SendMessage(hwnd,WM_SETTEXT,255,Integer(PChar(frm_ch_invoice.fname5))); end; if (invcontrid=68) and (frm_ch_invoice.fprice6<>'') then begin SendMessage(hwnd,WM_SETTEXT,255,Integer(PChar(frm_ch_invoice.fprice6))); end; if (invcontrid=69) and (frm_ch_invoice.fprice6<>'') then begin SendMessage(hwnd,WM_SETTEXT,255,Integer(PChar(inttostr(1)))) end; if (invcontrid=70) and (frm_ch_invoice.fprice6<>'') then begin SendMessage(hwnd,WM_SETTEXT,255,Integer(PChar(inttostr(1)))) end; if (invcontrid=47) and (frm_ch_invoice.fname6<>'') then begin SendMessage(hwnd,WM_SETTEXT,255,Integer(PChar(frm_ch_invoice.fname6))); end; if (invcontrid=64) and (frm_ch_invoice.fprice7<>'') then begin SendMessage(hwnd,WM_SETTEXT,255,Integer(PChar(frm_ch_invoice.fprice7))); end; if (invcontrid=65) and (frm_ch_invoice.fprice7<>'') then begin SendMessage(hwnd,WM_SETTEXT,255,Integer(PChar(inttostr(1)))) end; if (invcontrid=66) and (frm_ch_invoice.fprice7<>'') then begin SendMessage(hwnd,WM_SETTEXT,255,Integer(PChar(inttostr(1)))) end; if (invcontrid=45) and (frm_ch_invoice.fname7<>'') then begin SendMessage(hwnd,WM_SETTEXT,255,Integer(PChar(frm_ch_invoice.fname7))); end; if invcontrid=102 then begin SendMessage(hwnd,WM_SETTEXT,255,Integer(PChar(frm_ch_invoice.t_ch_invoice.fieldbyname('备注').asstring))); end; if invcontrid=106 then begin SendMessage(hwnd,WM_SETTEXT,255,Integer(PChar(frm_ch_invoice.t_ch_invoice.fieldbyname('提单号').asstring))); end; end else if get_parameters_value(155,'0')='2' then begin if invcontrid=9 then begin SendMessage(hwnd,WM_SETTEXT,255,Integer(PChar(frm_ch_invoice.t_ch_invoice.fieldbyname('银行账号').asstring))) end; if invcontrid=11 then begin SendMessage(hwnd,WM_SETTEXT,255,Integer(PChar(frm_ch_invoice.t_ch_invoice.fieldbyname('开户银行').asstring))) end; if invcontrid=13 then begin // 原来为13 frm_ch_invoice.bibie:=hwnd; end; if invcontrid=24 then begin //原来为21 SendMessage(hwnd,WM_SETTEXT,255,Integer(PChar(frm_ch_invoice.t_ch_invoice.fieldbyname('提单号').asstring))) end; if invcontrid=26 then begin //原来为23 SendMessage(hwnd,WM_SETTEXT,255,Integer(PChar(frm_ch_invoice.t_ch_invoice.fieldbyname('目的港').asstring))) end; if invcontrid=28 then begin //原来为25 SendMessage(hwnd,WM_SETTEXT,255,Integer(PChar(frm_ch_invoice.t_ch_invoice.fieldbyname('卸货港').asstring))) end; if invcontrid=30 then begin //原来为27 SendMessage(hwnd,WM_SETTEXT,255,Integer(PChar(frm_ch_invoice.t_ch_invoice.fieldbyname('启运港').asstring))) end; if invcontrid=32 then begin //原来为29 SendMessage(hwnd,WM_SETTEXT,255,Integer(PChar(frm_ch_invoice.t_ch_invoice.fieldbyname('船名航次').asstring))) end; if invcontrid=23 then begin //原来为31 SendMessage(hwnd,WM_SETTEXT,255,Integer(PChar(frm_ch_invoice.t_ch_invoice.fieldbyname('付款单位').asstring))) end; if (invcontrid=78) and (frm_ch_invoice.fprice1<>'') then begin //原来为 77 SendMessage(hwnd,WM_SETTEXT,255,Integer(PChar(frm_ch_invoice.fprice1))); end; if (invcontrid=79) and (frm_ch_invoice.fprice1<>'') then begin //原来为 78 // SendMessage(hwnd,WM_SETTEXT,255,Integer(PChar(StrNum))); frm_ch_invoice.feinum:=hwnd; end; if (invcontrid=81) and (frm_ch_invoice.fname1<>'') then begin //原来为 80 SendMessage(hwnd,WM_SETTEXT,255,Integer(PChar(frm_ch_invoice.fname1))); end; if (invcontrid=74) and (frm_ch_invoice.fprice2<>'') then begin //原来为 73 SendMessage(hwnd,WM_SETTEXT,255,Integer(PChar(frm_ch_invoice.fprice2))); end; if (invcontrid=75) and (frm_ch_invoice.fprice2<>'') then begin //原来为 74 // SendMessage(hwnd,WM_Char,Wparam('1'),1); SendMessage(hwnd,WM_SETTEXT,255,Integer(PChar(StrNum))); end; if (invcontrid=83) and (frm_ch_invoice.fname2<>'') then begin //原来为 82 SendMessage(hwnd,WM_SETTEXT,255,Integer(PChar(frm_ch_invoice.fname2))); end; if (invcontrid=71) and (frm_ch_invoice.fprice3<>'') then begin //原来为 70 SendMessage(hwnd,WM_SETTEXT,255,Integer(PChar(frm_ch_invoice.fprice3))); end; if (invcontrid=72) and (frm_ch_invoice.fprice3<>'') then begin //原来为 71 // SendMessage(hwnd,WM_Char,Wparam('1'),1); SendMessage(hwnd,WM_SETTEXT,255,Integer(PChar(StrNum))); end; if (invcontrid=85) and (frm_ch_invoice.fname3<>'') then begin //原来为 84 SendMessage(hwnd,WM_SETTEXT,255,Integer(PChar(frm_ch_invoice.fname3))); end; if (invcontrid=68) and (frm_ch_invoice.fprice4<>'') then begin //原来为 67 SendMessage(hwnd,WM_SETTEXT,255,Integer(PChar(frm_ch_invoice.fprice4))); end; if (invcontrid=69) and (frm_ch_invoice.fprice4<>'') then begin //原来为 68 // SendMessage(hwnd,WM_Char,Wparam('1'),1); SendMessage(hwnd,WM_SETTEXT,255,Integer(PChar(StrNum))); end; if (invcontrid=87) and (frm_ch_invoice.fname4<>'') then begin //原来为 86 SendMessage(hwnd,WM_SETTEXT,255,Integer(PChar(frm_ch_invoice.fname4))); end; if (invcontrid=65) and (frm_ch_invoice.fprice5<>'') then begin //原来为 64 SendMessage(hwnd,WM_SETTEXT,255,Integer(PChar(frm_ch_invoice.fprice5))); end; if (invcontrid=66) and (frm_ch_invoice.fprice5<>'') then begin //原来为 65 // SendMessage(hwnd,WM_Char,Wparam('1'),1); SendMessage(hwnd,WM_SETTEXT,255,Integer(PChar(StrNum))); end; if (invcontrid=89) and (frm_ch_invoice.fname5<>'') then begin //原来为 88 SendMessage(hwnd,WM_SETTEXT,255,Integer(PChar(frm_ch_invoice.fname5))); end; if (invcontrid=49) and (frm_ch_invoice.fprice6<>'') then begin //原来为 48 SendMessage(hwnd,WM_SETTEXT,255,Integer(PChar(frm_ch_invoice.fprice6))); end; if (invcontrid=50) and (frm_ch_invoice.fprice6<>'') then begin //原来为 49 // SendMessage(hwnd,WM_Char,Wparam('1'),1); SendMessage(hwnd,WM_SETTEXT,255,Integer(PChar(StrNum))); end; if (invcontrid=91) and (frm_ch_invoice.fname6<>'') then begin //原来为 90 SendMessage(hwnd,WM_SETTEXT,255,Integer(PChar(frm_ch_invoice.fname6))); end; if (invcontrid=46) and (frm_ch_invoice.fprice7<>'') then begin //原来为 45 SendMessage(hwnd,WM_SETTEXT,255,Integer(PChar(frm_ch_invoice.fprice7))); end; if (invcontrid=47) and (frm_ch_invoice.fprice7<>'') then begin //原来为 46 // SendMessage(hwnd,WM_Char,Wparam('1'),1); SendMessage(hwnd,WM_SETTEXT,255,Integer(PChar(StrNum))); end; if (invcontrid=92) and (frm_ch_invoice.fname7<>'') then begin //原来为 92 SendMessage(hwnd,WM_SETTEXT,255,Integer(PChar(frm_ch_invoice.fname7))); end; if invcontrid=76 then begin //原来为 75 SendMessage(hwnd,WM_SETTEXT,255,Integer(PChar(frm_ch_invoice.t_ch_invoice.fieldbyname('备注').asstring))) end; end; invcontrid:=invcontrid+1; result:=true; end; function Tfrm_ch_invoice.getfeestr: boolean; //初始化税控数据 var i,j:integer; str_num,str:string; begin fname1:=''; fname2:=''; fname3:=''; fname4:=''; fname5:=''; fname6:=''; fname7:=''; fprice1:=''; fprice2:=''; fprice3:=''; fprice4:=''; fprice5:=''; fprice6:=''; fprice7:=''; fnum:='1'; try for i:=0 to DM_CostType.Lines.Count-1 do begin str:=trim(DM_CostType.Lines[i]); if str<>'' then begin if i=0 then begin fname1:=str; end; if i=1 then begin fname2:=str; end; if i=2 then begin fname3:=str; end; if i=3 then begin fname4:=str; end; if i=4 then begin fname5:=str; end; if i=5 then begin fname6:=str; end; if i=6 then begin fname7:=str; end; end; end; for i:=0 to DM_Money.Lines.Count-1 do begin str:=trim(DM_Money.Lines[i]); str_num:=''; for j:=1 to length(str) do begin if (str[j]='0') or (str[j]='1') OR (str[j]='2') or (str[j]='3') OR (str[j]='4') or (str[j]='5') OR (str[j]='6') or (str[j]='7') OR (str[j]='8') or (str[j]='9') or (str[j]='.')then begin str_num:=str_num+str[j]; end else begin end; end; if str<>'' then begin if i=0 then begin fprice1:=str_num; end; if i=1 then begin fprice2:=str_num; end; if i=2 then begin fprice3:=str_num; end; if i=3 then begin fprice4:=str_num; end; if i=4 then begin fprice5:=str_num; end; if i=5 then begin fprice6:=str_num; end; if i=6 then begin fprice7:=str_num; end; end; end; finally end; end; procedure Tfrm_ch_invoice.bsSkinPanel2Resize(Sender: TObject); var i:integer; begin if not if_reg(417) then begin i:=round(bsSkinPanel2.Width/12); bsSkinButton9.Width:=i; bsSkinButton2.Width:=i; bsSkinButton10.Width:=i; bsSkinButton6.Width:=i; bsSkinButton7.Width:=i; bsSkinButton8.Width:=i; bsSkinButton1.Width:=i; bsSkinButton3.Width:=i; bsSkinButton38.Width:=i; bsSkinButton41.Width:=i; bsSkinButton42.Width:=i; end else begin i:=round(bsSkinPanel2.Width/13); bsSkinButton9.Width:=i; bsSkinButton2.Width:=i; bsSkinButton10.Width:=i; bsSkinButton6.Width:=i; bsSkinButton7.Width:=i; bsSkinButton8.Width:=i; bsSkinButton1.Width:=i; bsSkinButton3.Width:=i; bsSkinButton38.Width:=i; bsSkinButton34.Width:=i; bsSkinButton41.Width:=i; bsSkinButton42.Width:=i; end; end; procedure Tfrm_ch_invoice.bsSkinPageControl2Change(Sender: TObject); begin if bsSkinPageControl2.TabIndex=1 then if StrToBool(get_parameters_value(85,'false')) then begin bsSkinTabSheet4.TabVisible:=false; bsSkinTabSheet5.TabVisible:=false; bsSkinTabSheet6.TabVisible:=false; bsSkinTabSheet7.TabVisible:=false; bsSkinTabSheet14.TabVisible:=true; v_fee_do_bscard.Close; v_fee_do_bscard.DataSource:=t_ch_invoice_shen1; v_fee_do_bscard.Open; v_fee_do_seae.Close; v_fee_do_seai.Close; v_fee_do_aire.Close; v_fee_do_airi.Close; end else begin bsSkinTabSheet4.TabVisible:=true; bsSkinTabSheet5.TabVisible:=true; bsSkinTabSheet6.TabVisible:=true; bsSkinTabSheet7.TabVisible:=true; bsSkinTabSheet14.TabVisible:=false; v_fee_do_seae.open; v_fee_do_seai.open; v_fee_do_aire.open; v_fee_do_airi.open; v_fee_do_bscard.Close; end; end; procedure Tfrm_ch_invoice.dxDBGridColumn43CustomDraw(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 AColor:=dxgrid_color(ANode.Strings[dxDBGrid11Column26.Index],ANode.Strings[dxDBGridColumn43.Index]); AFont.Color:=clblack; end; procedure Tfrm_ch_invoice.dxDBGridColumn44CustomDraw(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 AColor:=dxgrid_color_fee(ANode.strings[dxDBGridColumn44.Index]); AFont.Color:=clblack; end; procedure Tfrm_ch_invoice.fra_ch_add_do1MenuItem1Click(Sender: TObject); begin fra_ch_add_do1.MenuItem1Click(Sender); end; procedure Tfrm_ch_invoice.bsSkinButton36Click(Sender: TObject); var ASqlQuery:TADOQuery; str1,str2:Tstringlist; begin ASqlQuery:=CreateAdoQuery; str1:=Tstringlist.Create; str2:=Tstringlist.Create; with ASqlQuery do try str1.Clear; str2.Clear; Close;SQL.Clear; SQL.Add('select 主提单号,sum(金额) 金额 from v_fee_do_bscard'); SQL.Add('where 工作编号=:申请编号'); SQL.Add('Group by 主提单号'); SQL.Add('order by 主提单号'); Parameters.ParamByName('申请编号').Value:=t_ch_invoice.fieldByName('申请编号').AsString; Open;First; while not eof do begin if t_ch_invoice['币别']='USD' then str1.Add(get_parameters_value(7,'代理海运费')+fieldByName('主提单号').AsString) else str1.Add(get_parameters_value(147,'代理运杂费')+fieldByName('主提单号').AsString); str2.Add(fieldByName('金额').AsString); Next; end; t_ch_invoice.Edit; t_ch_invoice['费用列表']:=str1.text; t_ch_invoice['金额列表']:=str2.text; t_ch_invoice.Post; finally Free; str1.Free; str2.Free; end; end; procedure Tfrm_ch_invoice.DBComboBoxEh3CloseUp(Sender: TObject; Accept: Boolean); begin DBComboBoxEh3.items.Clear; end; procedure Tfrm_ch_invoice.DBComboBoxEh3DropDown(Sender: TObject); var aQuery:TADOQuery; begin DBComboBoxEh3.Items.Clear; if frm_data_share.t_crm_client_all.locate('客户简称',RxDBLookupCombo3.DisplayValues[1],[]) then begin if Trim(frm_data_share.t_crm_client_all.fieldbyname('纳税人识别号').asstring)<>'' then DBComboBoxEh3.Items.Add(frm_data_share.t_crm_client_all.fieldbyname('纳税人识别号').asstring); end; { aQuery:=CreateAdoQuery; with aQuery do try Close;SQL.Clear; SQL.Add('select distinct 纳税人识别号 from t_ch_invoice'); SQL.Add('Where 发票抬头=:发票抬头 and 纳税人识别号<>'''''); SQL.Add('order by 纳税人识别号'); Parameters.ParamByName('发票抬头').Value:=t_ch_invoice.FieldByName('发票抬头').AsString; Open; First; while not Eof do begin DBComboBoxEh3.Items.Add(FieldByName('纳税人识别号').AsString); Next; end; finally Close; FreeAndNil(aQuery); end; } end; procedure Tfrm_ch_invoice.DBComboBoxEh4CloseUp(Sender: TObject; Accept: Boolean); begin DBComboBoxEh4.items.Clear; end; procedure Tfrm_ch_invoice.DBComboBoxEh4DropDown(Sender: TObject); var aQuery:TADOQuery; begin DBComboBoxEh4.Items.Clear; if frm_data_share.t_crm_client_all.locate('客户简称',RxDBLookupCombo3.DisplayValues[1],[]) then begin if (Trim(frm_data_share.t_crm_client_all.fieldbyname('通讯地址').asstring)<>'') and (Trim(frm_data_share.t_crm_client_all.fieldbyname('电话').asstring)<>'') then DBComboBoxEh4.Items.Add(frm_data_share.t_crm_client_all.fieldbyname('通讯地址').asstring+frm_data_share.t_crm_client_all.fieldbyname('电话').asstring); end; { aQuery:=CreateAdoQuery; with aQuery do try Close;SQL.Clear; SQL.Add('select distinct 地址电话 from t_ch_invoice'); SQL.Add('Where 发票抬头=:发票抬头 and 地址电话<>'''''); SQL.Add('order by 地址电话'); Parameters.ParamByName('发票抬头').Value:=t_ch_invoice.FieldByName('发票抬头').AsString; Open; First; while not Eof do begin DBComboBoxEh4.Items.Add(FieldByName('地址电话').AsString); Next; end; finally Close; FreeAndNil(aQuery); end; } end; procedure Tfrm_ch_invoice.DBComboBoxEh5DropDown(Sender: TObject); var aQuery:TADOQuery; begin DBComboBoxEh5.Items.Clear; if frm_data_share.t_crm_client_all.locate('客户简称',RxDBLookupCombo3.DisplayValues[1],[]) then begin if (Trim(frm_data_share.t_crm_client_all.fieldbyname('开户行RMB').asstring)<>'') and (Trim(frm_data_share.t_crm_client_all.fieldbyname('帐号RMB').asstring)<>'') then DBComboBoxEh5.Items.Add(frm_data_share.t_crm_client_all.fieldbyname('开户行RMB').asstring+frm_data_share.t_crm_client_all.fieldbyname('帐号RMB').asstring); if (Trim(frm_data_share.t_crm_client_all.fieldbyname('开户行USD').asstring)<>'') and (Trim(frm_data_share.t_crm_client_all.fieldbyname('帐号USD').asstring)<>'') then DBComboBoxEh5.Items.Add(frm_data_share.t_crm_client_all.fieldbyname('开户行USD').asstring+frm_data_share.t_crm_client_all.fieldbyname('帐号USD').asstring); end; { aQuery:=CreateAdoQuery; with aQuery do try Close;SQL.Clear; SQL.Add('select distinct 开户行及账号 from t_ch_invoice'); SQL.Add('Where 发票抬头=:发票抬头 and 开户行及账号<>'''''); SQL.Add('order by 开户行及账号'); Parameters.ParamByName('发票抬头').Value:=t_ch_invoice.FieldByName('发票抬头').AsString; Open; First; while not Eof do begin DBComboBoxEh5.Items.Add(FieldByName('开户行及账号').AsString); Next; end; finally Close; FreeAndNil(aQuery); end; } end; procedure Tfrm_ch_invoice.DBComboBoxEh5CloseUp(Sender: TObject; Accept: Boolean); begin DBComboBoxEh5.items.Clear; end; procedure Tfrm_ch_invoice.DBComboBoxEh1Change(Sender: TObject); var aQuery:TADOQuery; begin aQuery:=CreateAdoQuery; with aQuery do try Close;SQL.Clear; SQL.Add('select 发票抬头,纳税人识别号,地址电话,开户行及帐号,纳税类型 from t_crm_client_Invoice'); SQL.Add('Where 客户简称=:客户简称 and 发票抬头=:发票抬头'); Parameters.ParamByName('客户简称').Value:=t_ch_invoice.FieldByName('客户名称').AsString; Parameters.ParamByName('发票抬头').Value:=Trim(DBComboBoxEh1.Text); open; if not IsEmpty then begin if (t_ch_invoice.state=dsinsert) or (t_ch_invoice.state=dsedit) then begin DBComboBoxEh3.Text:=FieldByName('纳税人识别号').AsString; DBComboBoxEh4.Text:=FieldByName('地址电话').AsString; DBComboBoxEh5.Text:=FieldByName('开户行及帐号').AsString; DBEdit31.Text:=FieldByName('纳税类型').AsString; end end else begin Close;SQL.Clear; SQL.Add('select distinct 发票抬头,纳税人识别号,地址电话,开户行及账号,纳税类型 from t_ch_invoice'); SQL.Add('Where 发票抬头=:发票抬头 and 纳税人识别号<>'''' and 地址电话<>'''' and 开户行及账号<>'''' '); Parameters.ParamByName('发票抬头').Value:=Trim(DBComboBoxEh1.Text); Open; First; if (t_ch_invoice.state=dsinsert) or (t_ch_invoice.state=dsedit) then begin DBComboBoxEh3.Text:=FieldByName('纳税人识别号').AsString; DBComboBoxEh4.Text:=FieldByName('地址电话').AsString; DBComboBoxEh5.Text:=FieldByName('开户行及账号').AsString; DBEdit31.Text:=FieldByName('纳税类型').AsString; end; end; finally Close; FreeAndNil(aQuery); end; end; procedure Tfrm_ch_invoice.bsSkinButton37Click(Sender: TObject); var s:string; aAdoQuery:TADOQuery; begin s:=''; t_msg_mold.Close; t_msg_mold.sql.text:='select * from t_sys_msgmold where 消息类型=''销项发票模板'' '; t_msg_mold.open; aAdoQuery:=CreateAdoQuery; with aAdoQuery do try close; SQL.clear; sql.add('select 编号,业务编号, 主提单号,委托编号,船名,航次,开船日期,卸货港,目的地,装货港,分提单号,合同号,折算汇率'); sql.Add(',sum(case when 原始币别=''RMB'' then 原始金额 else 0 end) as 人民币'); sql.Add(',sum(case when 原始币别<>''RMB'' then 原始金额 else 0 end) as 外币'); sql.Add('from v_fee_do_bscard '); sql.Add('where 工作编号=:工作编号 '); sql.Add('Group by 编号,业务编号, 主提单号,委托编号,船名,航次,开船日期,卸货港,目的地,装货港,分提单号,合同号,折算汇率'); sql.Add('order by 编号,业务编号, 主提单号,委托编号,船名,航次,开船日期'); Parameters.ParamByName('工作编号').Value:=t_ch_invoice.fieldbyname('申请编号').AsString; Open;First; while not eof do begin if Trim(s)='' then s:=getstrfromdataset(aAdoQuery,t_msg_mold.fieldbyname('模板内容').asstring) else s:=s+#13#10+getstrfromdataset(aAdoQuery,t_msg_mold.fieldbyname('模板内容').asstring)+' '; Next; end; t_ch_invoice.Edit; t_ch_invoice.FieldByName('备注').AsString:=s; t_ch_invoice.Post; finally Free; end; end; procedure Tfrm_ch_invoice.bsSkinButton39Click(Sender: TObject); begin if not if_open('602') then begin showmessage('对不起你没有此模块的操作权限,请联系系统管理员开通权限!'); exit; end; t_msg_mold.Close; t_msg_mold.sql.text:='select * from t_sys_msgmold where 消息类型=''销项发票模板'' '; t_msg_mold.open; if t_msg_mold.IsEmpty then t_msg_mold.Insert; frm_msg_mold:=Tfrm_msg_mold.create(self); try frm_msg_mold.transtype:=5; frm_msg_mold.t_msg_mold1.DataSet:=t_msg_mold; frm_msg_mold.ShowModal; finally FreeAndNil(frm_msg_mold); end; end; procedure Tfrm_ch_invoice.t_msg_moldAfterInsert(DataSet: TDataSet); begin dataset.FieldByName('消息类型').AsString:='销项发票模板'; end; procedure Tfrm_ch_invoice.t_ch_invoice_itemBeforePost(DataSet: TDataSet); var Amt,price:double; begin if trim(DataSet.FieldByName('商品名称').asstring)='' then begin showmessage('商品名称不能为空!!'); abort; end; if DataSet.FieldByName('单价').AsFloat=0 then begin showmessage('单价不能为空!!'); abort; end; if DataSet.FieldByName('数量').AsFloat=0 then begin showmessage('数量不能为空!!'); abort; end; if DataSet.fieldbyname('含税单价').asfloat<>0 then begin DataSet.fieldbyname('单价').asfloat:=DataSet.fieldbyname('含税单价').asfloat/(1+DataSet.fieldbyname('税率').asfloat); DataSet.FieldByName('税额').Value:=s_w(2,DataSet.fieldbyname('数量').asfloat*DataSet.fieldbyname('含税单价').asfloat/(1+DataSet.fieldbyname('税率').asfloat)*DataSet.fieldbyname('税率').asfloat); DataSet.FieldByName('金额').Value:=s_w(strtoint(apointnum),DataSet.fieldbyname('含税单价').asfloat*DataSet.fieldbyname('数量').asfloat-DataSet.FieldByName('税额').Value) end else begin price:=DataSet.fieldbyname('单价').asfloat*DataSet.fieldbyname('税率').asfloat+DataSet.fieldbyname('单价').asfloat; DataSet.FieldByName('金额').Value:=s_w(strtoint(apointnum),DataSet.fieldbyname('单价').asfloat*DataSet.fieldbyname('数量').asfloat); price:=s_w(strtoint(apointnum),price); Amt:=s_w(strtoint(apointnum),price*DataSet.fieldbyname('数量').asfloat); DataSet.FieldByName('税额').Value:=s_w(strtoint(apointnum),Amt/(1+DataSet.fieldbyname('税率').AsFloat)*DataSet.fieldbyname('税率').AsFloat); end; end; procedure Tfrm_ch_invoice.t_ch_invoice_itemNewRecord(DataSet: TDataSet); begin DataSet.FieldByName('商品名称').asstring:=''; DataSet.FieldByName('规格型号').asstring:='0'; DataSet.FieldByName('计量单位').asstring:='票'; DataSet.FieldByName('数量').AsInteger:=1; DataSet.FieldByName('单价').AsFloat:=0; DataSet.FieldByName('金额').AsFloat:=0; DataSet.FieldByName('税率').AsFloat:=frm_data_share.t_sys_company.fieldbyname('税率').AsFloat; DataSet.FieldByName('税额').AsFloat:=0; DataSet.FieldByName('折扣').AsFloat:=0; DataSet.FieldByName('备注').asstring:=''; DataSet.FieldByName('含税价标志').Value:=0; end; procedure Tfrm_ch_invoice.t_ch_invoice_itemBeforeEdit(DataSet: TDataSet); begin if not modify_all then begin if t_ch_invoice.FieldByName('是否废除').asboolean then begin showmessage('发票已经废除,不能修改!!'); abort; end; if t_ch_invoice.FieldByName('财务').asboolean then begin showmessage('发票生成凭证,不能修改!!'); abort; end; if t_ch_invoice.FieldByName('是否打印').asboolean then begin showmessage('发票已经打印,不能修改!!'); abort; end; end; end; procedure Tfrm_ch_invoice.CheckBox1Click(Sender: TObject); var inifile1:Tinifile; begin //显示发票金额列表 inifile1:=Tinifile.Create(ExtractFilePath(application.ExeName)+'main.ini'); inifile1.WriteBool('other','invoicedsp',CheckBox1.Checked); inifile1.free; if CheckBox1.Checked then begin bsSkinPanel8.Visible:=true; end else begin bsSkinPanel8.Visible:=false; end; end; procedure Tfrm_ch_invoice.bsSkinButton40Click(Sender: TObject); begin frm_main.view_momo(t_ch_invoice1,'备注'); end; procedure Tfrm_ch_invoice.dxDBGrid2Column29CustomDraw(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[dxDBGrid2Column29.Index])='TRUE'then AColor :=clred else AColor :=clwhite; AFont.Color:=clblack; end; procedure Tfrm_ch_invoice.dxDBGrid1Column43CustomDraw(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[dxDBGrid1Column43.Index])='TRUE'then AColor :=clred else AColor :=clwhite; AFont.Color:=clblack; end; procedure Tfrm_ch_invoice.t_ch_invoice_itemAfterPost(DataSet: TDataSet); var aAdoQuery:TAdoQuery; amt:Double; begin aAdoQuery:=CreateAdoQuery; with aAdoQuery do try close; SQL.clear; sql.add('select sum(金额+税额) Amt'); sql.Add('from t_ch_invoice_item '); sql.Add('where IN_ID=:IN_ID'); Parameters.ParamByName('IN_ID').Value:=t_ch_invoice.fieldbyname('IN_ID').AsInteger; Open;First; amt:=fieldbyname('Amt').AsFloat; if Abs(Amt)<0.1 then begin close; SQL.clear; sql.add('update t_ch_invoice set 合计金额=:合计金额,实际金额=:实际金额,金额大写=:金额大写'); sql.Add('where IN_ID=:IN_ID'); Parameters.ParamByName('IN_ID').Value:=t_ch_invoice.fieldbyname('IN_ID').AsInteger; Parameters.ParamByName('合计金额').Value:=Amt; Parameters.ParamByName('实际金额').Value:=Amt; if Amt<0 then begin Parameters.ParamByName('金额大写').Value:=FloatToStr(Amt)+'(付)'; end else Parameters.ParamByName('金额大写').Value:=FloatToStr(Amt); ExecSQL; end else begin close; SQL.clear; sql.add('update t_ch_invoice set 合计金额=:合计金额,实际金额=:实际金额,金额大写=:金额大写'); sql.Add('where IN_ID=:IN_ID'); Parameters.ParamByName('IN_ID').Value:=t_ch_invoice.fieldbyname('IN_ID').AsInteger; Parameters.ParamByName('合计金额').Value:=Amt; Parameters.ParamByName('实际金额').Value:=Amt; if Amt<0 then begin Parameters.ParamByName('金额大写').Value:=invoice_max(Amt,''+'(付)'); end else Parameters.ParamByName('金额大写').Value:=invoice_max(Amt,''); ExecSQL; end; t_ch_invoice.Refresh; finally Free; end; end; procedure Tfrm_ch_invoice.t_ch_invoice_itemBeforeInsert(DataSet: TDataSet); begin if t_ch_invoice.state in [dsedit,dsinsert] then t_ch_invoice.post; end; procedure Tfrm_ch_invoice.dxDBGrid11DblClick(Sender: TObject); begin fee_view(v_fee_do_bscard1.dataset.fieldbyname('编号').asstring); end; procedure Tfrm_ch_invoice.dxDBGrid12DblClick(Sender: TObject); begin fee_view(v_fee_do_bscard1.dataset.fieldbyname('编号').asstring); end; procedure Tfrm_ch_invoice.fra_ch_add_do1N1Click(Sender: TObject); begin fra_ch_add_do1.N1Click(Sender); end; procedure Tfrm_ch_invoice.bsSkinButton42Click(Sender: TObject); var Pnt:Tpoint; begin Pnt:=bsSkinButton42.ClientToScreen(Point(0,bsSkinButton42.Height)); PopupMenu6.Popup(Pnt.x,Pnt.y); end; procedure Tfrm_ch_invoice.MenuItem3Click(Sender: TObject); var strBillNo,str_feeValid:string; begin if t_ch_invoice.IsEmpty then begin Showmessage('没有发票数据'); exit; end; if not if_open('418') then begin showmessage('对不起你没有此模块的操作权限!'); exit; end; if t_ch_invoice.FieldByName('是否锁定').AsBoolean then begin showmessage('发票已经审核!!'); end else begin try if t_ch_invoice.State in [dsedit,dsinsert] then t_ch_invoice.post; t_ch_invoice.Refresh; modify_all:=true; t_ch_invoice.edit; t_ch_invoice['是否锁定']:=True; t_ch_invoice.post; modify_all:=false; except modify_all:=false; showmessage('审核失败!!'); end; t_ch_invoice.Refresh; end; end; procedure Tfrm_ch_invoice.MenuItem4Click(Sender: TObject); var str_feeValid:string; begin if t_ch_invoice.IsEmpty then exit; if t_ch_invoice.State in [dsedit,dsinsert] then t_ch_invoice.post; if not if_open('418') then begin showmessage('对不起你没有此模块的操作权限!'); exit; end; t_ch_invoice.first; while not t_ch_invoice.eof do begin if t_ch_invoice.FieldByName('是否锁定').AsBoolean then begin // showmessage('帐单已经审核!!'); end else begin try t_ch_invoice.Refresh; modify_all:=true; t_ch_invoice.edit; t_ch_invoice['是否锁定']:=True; t_ch_invoice.post; modify_all:=false; except on e: Exception do begin modify_all:=false; end; end; t_ch_invoice.Refresh; end; t_ch_invoice.Next; end; end; procedure Tfrm_ch_invoice.bsSkinButton41Click(Sender: TObject); begin if t_ch_invoice.IsEmpty then exit; if not if_open('419') then begin showmessage('对不起你没有此模块的操作权限!'); exit; end; if not t_ch_invoice.FieldByName('是否锁定').AsBoolean then begin showmessage('帐单没有必要取消审核!!'); end else begin try modify_all:=true; t_ch_invoice.edit; t_ch_invoice['是否锁定']:=false; t_ch_invoice.post; modify_all:=false; except modify_all:=false; showmessage('取消锁定失败!!'); end; t_ch_invoice.Refresh; end; end; end.