unit u_ch_invoice; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, ComCtrls, bsSkinTabs, bsSkinCtrls, DB, ADODB, dxExEdtr, dxCntner, dxTL, dxDBCtrl, dxDBGrid, dxDBTLCl, dxGrClms, wwdblook, StdCtrls, DBCtrls, RxLookup, bsdbctrls, Mask, wwdbdatetimepicker, ExtCtrls, Menus, XPMenu; 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; dxDBGrid1: TdxDBGrid; dxDBGrid1Column1: TdxDBGridMaskColumn; 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; dxDBGrid1Column19: TdxDBGridColumn; dxDBGrid1Column20: TdxDBGridColumn; dxDBGrid1Column21: TdxDBGridColumn; dxDBGrid1Column22: TdxDBGridMaskColumn; dxDBGrid1Column23: TdxDBGridMaskColumn; dxDBGrid1Column24: TdxDBGridMaskColumn; dxDBGrid1Column25: TdxDBGridCheckColumn; dxDBGrid1Column26: TdxDBGridMaskColumn; dxDBGrid1Column27: TdxDBGridDateColumn; dxDBGrid1Column28: TdxDBGridMaskColumn; dxDBGrid1Column29: TdxDBGridCheckColumn; dxDBGrid1Column30: TdxDBGridMaskColumn; dxDBGrid1Column31: TdxDBGridMaskColumn; dxDBGrid1Column32: TdxDBGridCheckColumn; dxDBGrid1Column33: TdxDBGridMaskColumn; dxDBGrid1Column34: TdxDBGridDateColumn; dxDBGrid1Column35: TdxDBGridMaskColumn; dxDBGrid1Column36: TdxDBGridDateColumn; 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; s_invoice: TScrollBox; Shape9: TShape; Label27: TLabel; Label28: TLabel; Label29: TLabel; Label30: TLabel; Shape2: TShape; Label31: TLabel; Label32: TLabel; Shape3: TShape; Label33: TLabel; Label34: TLabel; Shape4: TShape; Shape5: TShape; Label35: TLabel; Label36: TLabel; Label37: TLabel; Label38: TLabel; Shape6: TShape; Label39: TLabel; Label40: TLabel; Shape7: TShape; Label41: TLabel; Label42: TLabel; Shape8: TShape; Shape10: TShape; Label43: TLabel; Shape11: TShape; Shape12: TShape; Shape13: TShape; Label44: TLabel; Label45: TLabel; Shape14: TShape; Label46: TLabel; Label47: TLabel; Label48: TLabel; Label49: TLabel; Label50: TLabel; Label51: TLabel; Label52: TLabel; Label53: TLabel; Label55: TLabel; Label56: TLabel; Label58: TLabel; Label60: TLabel; Label61: TLabel; Label62: TLabel; Shape1: TShape; Label24: TLabel; Label26: TLabel; wwDBDateTimePicker1: TwwDBDateTimePicker; DE_ShipName: TDBEdit; DE_BLNO: TDBEdit; wwDBDateTimePicker2: TwwDBDateTimePicker; DM_ChaCon: TDBMemo; DM_CostType: TDBMemo; DM_Money: TDBMemo; DM: TDBMemo; DE_SumUpper: TDBEdit; DBSumLower: TDBEdit; DE_BusnessNo: TDBEdit; DE_TaxNo: TDBEdit; DE_Maker: TDBEdit; wwDBDateTimePicker3: TwwDBDateTimePicker; wwDBLookupCombo6: TwwDBLookupCombo; wwDBLookupCombo7: TwwDBLookupCombo; DBCheckBox3: TDBCheckBox; wwDBLookupCombo10: TwwDBLookupCombo; wwDBLookupCombo11: TwwDBLookupCombo; wwDBLookupCombo12: TwwDBLookupCombo; RxDBLookupCombo2: TRxDBLookupCombo; DBEdit27: 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; bsSkinPanel6: TbsSkinPanel; Label22: TLabel; Label23: TLabel; DBEdit13: TDBEdit; DBEdit15: TDBEdit; bsSkinDBCheckRadioBox2: TbsSkinDBCheckRadioBox; bsSkinDBCheckRadioBox3: TbsSkinDBCheckRadioBox; bsSkinPageControl4: TbsSkinPageControl; bsSkinTabSheet8: TbsSkinTabSheet; dxDBGrid7: TdxDBGrid; dxDBGridMaskColumn70: TdxDBGridMaskColumn; dxDBGridMaskColumn71: TdxDBGridMaskColumn; dxDBGridMaskColumn72: TdxDBGridMaskColumn; dxDBGridMaskColumn73: TdxDBGridMaskColumn; dxDBGridMaskColumn74: TdxDBGridMaskColumn; dxDBGridColumn21: TdxDBGridColumn; dxDBGridColumn22: TdxDBGridColumn; dxDBGridMaskColumn75: TdxDBGridMaskColumn; 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; dxDBGridColumn26: TdxDBGridColumn; dxDBGridMaskColumn90: TdxDBGridMaskColumn; 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; dxDBGridColumn30: TdxDBGridColumn; dxDBGridMaskColumn105: TdxDBGridMaskColumn; 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; dxDBGridColumn34: TdxDBGridColumn; dxDBGridMaskColumn117: TdxDBGridMaskColumn; dxDBGridDateColumn19: TdxDBGridDateColumn; dxDBGridDateColumn20: TdxDBGridDateColumn; dxDBGridMaskColumn118: TdxDBGridMaskColumn; dxDBGridMaskColumn119: TdxDBGridMaskColumn; dxDBGridMaskColumn120: TdxDBGridMaskColumn; dxDBGridColumn35: TdxDBGridColumn; dxDBGridColumn36: TdxDBGridColumn; dxDBGridMaskColumn121: TdxDBGridMaskColumn; dxDBGridMaskColumn122: TdxDBGridMaskColumn; dxDBGridMaskColumn123: TdxDBGridMaskColumn; 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; dxDBGrid7Column22: TdxDBGridColumn; dxDBGrid8Column22: TdxDBGridColumn; dxDBGrid9Column19: TdxDBGridColumn; dxDBGrid10Column19: TdxDBGridColumn; dxDBGrid1Column37: TdxDBGridColumn; Label66: TLabel; DBEdit29: TDBEdit; t_ch_invoice_head: TADOQuery; t_ch_invoice_head1: TDataSource; wwDBLookupCombo1: TwwDBLookupCombo; dxDBGrid7Column23: TdxDBGridColumn; dxDBGrid8Column23: TdxDBGridColumn; dxDBGrid9Column20: TdxDBGridColumn; dxDBGrid10Column20: TdxDBGridColumn; dxDBGrid3Column23: TdxDBGridColumn; dxDBGrid6Column20: TdxDBGridColumn; dxDBGrid5Column20: TdxDBGridColumn; dxDBGrid4Column23: TdxDBGridColumn; dxDBGrid1Column38: TdxDBGridCheckColumn; N7: TMenuItem; N8: TMenuItem; N9: TMenuItem; N19: TMenuItem; procedure FormClose(Sender: TObject; var Action: TCloseAction); procedure bsSkinButton5Click(Sender: TObject); procedure FormResize(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 wwDBLookupCombo10KeyPress(Sender: TObject; var Key: Char); procedure wwDBLookupCombo11KeyPress(Sender: TObject; var Key: Char); procedure wwDBLookupCombo12KeyPress(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); private { Private declarations } public { Public declarations } end; var frm_ch_invoice: Tfrm_ch_invoice; implementation uses u_main, my_sys_function, u_data_share, u_ch_invoice_add, u_ch_shen_query, u_ch_invoice_query; {$R *.dfm} procedure Tfrm_ch_invoice.FormClose(Sender: TObject; var Action: TCloseAction); begin savereggrid(dxdbgrid1,caption+'1'); savereggrid(dxdbgrid2,caption+'2'); 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.FormResize(Sender: TObject); var i:integer; begin i:=round(bsSkinPanel2.Width/9); bsSkinButton9.Width:=i; bsSkinButton2.Width:=i; bsSkinButton10.Width:=i; bsSkinButton6.Width:=i; bsSkinButton7.Width:=i; bsSkinButton8.Width:=i; bsSkinButton1.Width:=i; bsSkinButton3.Width:=i; 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/9); bsSkinButton23.Width:=i; bsSkinButton24.Width:=i; bsSkinButton28.Width:=i; bsSkinButton29.Width:=i; bsSkinButton30.Width:=i; bsSkinButton25.Width:=i; bsSkinButton26.Width:=i; bsSkinButton31.Width:=i; end else begin bsSkinButton25.Caption:='批准开票'; bsSkinButton22.Visible:=true; bsSkinButton27.Visible:=true; i:=round(bsSkinPanel3.Width/11); 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; end; bsSkinButton32.Left:=dxDBGrid2.Width-bsSkinButton32.Width-20; end; procedure Tfrm_ch_invoice.FormShow(Sender: TObject); begin t_ch_invoice.close; t_ch_invoice.sql.clear; t_ch_invoice.sql.add('select top 50 * from t_ch_invoice order by 开票日期 desc'); t_ch_invoice.open; ADOQuery1.open; ADOQuery2.open; ADOQuery3.open; ADOQuery4.open; t_ch_invoice_head.open; if strtobool(get_parameters_value(1,'false'))then begin t_ch_invoice_shen.open; end else 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(' order by 申请编号'); t_ch_invoice_shen.Open; end; v_fee_do_seae.open; v_fee_do_seai.open; v_fee_do_aire.open; v_fee_do_airi.open; loadreggrid(dxdbgrid1,false,caption+'1'); loadreggrid(dxdbgrid2,false,caption+'2'); frm_data_share.t_crm_client_all.requery; frm_data_share.t_code_currency.requery; frm_data_share.t_sys_bank.requery; 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['工商登记号']:=frm_data_share.t_sys_company.fieldbyname('工商登记号').value; t_ch_invoice['税务登记号']:=frm_data_share.t_sys_company.fieldbyname('税务登记号').value; t_ch_invoice['复核状态']:=0; t_ch_invoice['是否打印']:=0; t_ch_invoice['是否废除']:=0; t_ch_invoice['费用列表']:='海运费'; 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; 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); begin IF t_ch_invoice.FieldByName('发票类别').asstring='自由发票'then begin t_ch_invoice['实际金额']:=0; end; t_ch_invoice['虚开金额']:=t_ch_invoice['合计金额']-t_ch_invoice['实际金额']; table_before_post(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; 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 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 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; end; 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 frm_data_share.t_sys_bank.IsEmpty then if frm_data_share.t_sys_bank.Locate('代码',RxDBLookupCombo2.DisplayValues[0],[])then t_ch_invoice['银行账号']:=frm_data_share.t_sys_bank.fieldbyname('银行账号').asstring; 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 currency_chi:=frm_data_share.t_code_currency.fieldbyname('中文名').asstring; 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: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; 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:integer; begin if t_ch_invoice.IsEmpty then exit; if t_ch_invoice.FieldByName('是否废除').asboolean then begin showmessage('发票已经废除,不能删除!!'); 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 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 t_ch_invoice.delete 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; 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); begin if t_ch_invoice_shen.IsEmpty then exit; 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 bsSkinButton25.Caption='开出发票' 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 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 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; {DBEdit19.ReadOnly:=false; DE_ShipName.ReadOnly:=false; DE_BLNO.ReadOnly:=false; wwDBDateTimePicker2.ReadOnly:=false; wwDBLookupCombo10.ReadOnly:=false; wwDBLookupCombo11.ReadOnly:=false; wwDBLookupCombo12.ReadOnly:=false; DM_ChaCon.ReadOnly:=false; DM_CostType.ReadOnly:=false; DM_Money.ReadOnly:=false; DE_SumUpper.ReadOnly:=false; DBSumLower.ReadOnly:=false; } wwDBLookupCombo6.ReadOnly:=false; 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; 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 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); 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.wwDBLookupCombo10KeyPress(Sender: TObject; var Key: Char); begin key_wwDBLookupCombo(Key,wwDBLookupCombo11); end; procedure Tfrm_ch_invoice.wwDBLookupCombo11KeyPress(Sender: TObject; var Key: Char); begin key_wwDBLookupCombo(Key,wwDBLookupCombo12); end; procedure Tfrm_ch_invoice.wwDBLookupCombo12KeyPress(Sender: TObject; var Key: Char); begin key_DBMemo(Key,DM_ChaCon); 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 trim(frm_data_share.t_crm_client_all.fieldbyname('发票抬头').asstring)<>''then 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.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 ('+''''+'申请开票'+'''' +') ' +'order by 申请编号 desc'); t_ch_invoice_shen.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 ('+''''+'驳回申请'+'''' +','+''''+'禁止修改'+''''+') ' +'order by 申请编号 desc'); t_ch_invoice_shen.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 (' +''''+'提交申请'+''''+','+''''+'申请修改'+''''+') ' +'order by 申请编号 desc'); t_ch_invoice_shen.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 ('+''''+'批准开票'+'''' +','+''''+'禁止修改'+''''+') ' +'order by 申请编号 desc'); t_ch_invoice_shen.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 ('+''''+'开出发票'+''''+') ' +'order by 申请编号 desc'); t_ch_invoice_shen.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); begin t_ch_invoice_head.Requery(); end; procedure Tfrm_ch_invoice.N8Click(Sender: TObject); var aQuery:TADOQuery; begin aQuery:=CreateAdoQuery; try 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.Requery(); finally FreeAndNil(aQuery); end; end; procedure Tfrm_ch_invoice.N19Click(Sender: TObject); var aQuery:TADOQuery; begin aQuery:=CreateAdoQuery; try 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.Requery(); finally FreeAndNil(aQuery); end; end; end.