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

2026 lines
67 KiB
Plaintext

This file contains ambiguous Unicode characters!

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

unit u_op_seae_paper_print;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, dxExEdtr, dxCntner, dxTL, dxDBCtrl, dxDBGrid, bsSkinCtrls, DB,
ADODB, ExtCtrls, RxLookup, StdCtrls, wwdbdatetimepicker, wwdblook, Menus,
Mask, bsSkinBoxCtrls, bsdbctrls,DateUtils, kbmMemTable, DBCtrlsEh,ShellAPI,
ComCtrls, bsSkinTabs, dxDBTLCl, dxGrClms, cxDBLabel, cxControls,
cxContainer, cxEdit, cxLabel, cxTextEdit, cxMaskEdit, cxDropDownEdit,
cxDBEdit, OleCtrls, iWebPDFEditorLib_TLB, cxCheckBox, cxProgressBar,IniFiles,
AcroPDFLib_TLB;
type
Tfrm_op_seae_paper_print = class(TForm)
qry_paper_detail: TADOQuery;
ds2_detail: TDataSource;
PopupMenu1: TPopupMenu;
N1: TMenuItem;
bsSkinPageControl1: TbsSkinPageControl;
bsSkinTabSheet1: TbsSkinTabSheet;
bskntbsht2_detail: TbsSkinTabSheet;
bsSkinPanel3: TbsSkinPanel;
bsSkinButton4: TbsSkinButton;
btn6_exit: TbsSkinButton;
btn_seach2: TbsSkinButton;
bsSkinButton14: TbsSkinButton;
bsSkinPanel4: TbsSkinPanel;
Label13: TLabel;
Label14: TLabel;
wwDBDateTimePicker5: TwwDBDateTimePicker;
wwDBDateTimePicker6: TwwDBDateTimePicker;
PopupMenu2: TPopupMenu;
MenuItem1: TMenuItem;
Edit6_searchtdh: TEdit;
Label8: TLabel;
bsknpnl1: TbsSkinPanel;
bsknpnl2: TbsSkinPanel;
qry1_paper_printlist: TADOQuery;
Edit1_tdzbh: TEdit;
lbl14: TLabel;
bsknpnl4_NewQDT: TbsSkinPanel;
lbl15_searchqdthm: TLabel;
ds1: TDataSource;
qry_crm_client: TADOQuery;
ds_crm_client: TDataSource;
dxdbgrdclmndxdbgrid1dxdbgrdclmnDBGrid1Column1: TdxDBGridColumn;
dxdbgrdclmndxdbgrid1dxdbgrdclmnDBGrid1Column2: TdxDBGridColumn;
dxdbgrdclmndxdbgrid1dxdbgrdclmnDBGrid1Column3: TdxDBGridColumn;
dxdbgrdclmndxdbgrid1dxdbgrdclmnDBGrid1Column4: TdxDBGridColumn;
dxdbgrdclmndxdbgrid1dxdbgrdclmnDBGrid1Column5: TdxDBGridColumn;
dxdbgrdclmndxdbgrid1dxdbgrdclmnDBGrid1Column6: TdxDBGridColumn;
grp1: TGroupBox;
lbl4: TLabel;
wdbdtmpckr1_kc: TwwDBDateTimePicker;
lbl5: TLabel;
wdbdtmpckr2_kc: TwwDBDateTimePicker;
pnl1: TPanel;
btn4_exit: TbsSkinButton;
dxdbgrdclmndxdbgrid1dxdbgrdclmnDBGrid1Column7: TdxDBGridColumn;
dxdbgrdclmndxdbgrid1dxdbgrdclmnDBGrid1Column8: TdxDBGridColumn;
dxdbgrdclmndxdbgrid1dxdbgrdclmnDBGrid1Column9: TdxDBGridColumn;
dxdbgrdclmndxdbgrid1dxdbgrdclmnDBGrid1Column10: TdxDBGridColumn;
dxdbgrd1_S: TdxDBGrid;
dxdbgrdclmns: TdxDBGridColumn;
dxdbgrdclmndxdbgrd1xdbgrdclmndxdbgrd1Column2: TdxDBGridColumn;
dxdbgrdclmndxdbgrd1xdbgrdclmndxdbgrd1Column4: TdxDBGridColumn;
dxdbgrdclmndxdbgrd1xdbgrdclmndxdbgrd1Column5: TdxDBGridColumn;
dxdbgrdclmndxdbgrd1xdbgrdclmndxdbgrd1Column3: TdxDBGridColumn;
dxdbgrdclmndxdbgrd1xdbgrdclmndxdbgrd1Column6: TdxDBGridColumn;
dxdbgrdclmndxdbgrd1xdbgrdclmndxdbgrd1Column19: TdxDBGridColumn;
dxdbgrdclmndxdbgrd1xdbgrdclmndxdbgrd1Column13: TdxDBGridColumn;
dxdbgrdclmndxdbgrd1_SColumn9: TdxDBGridColumn;
dxdbgrdclmndxdbgrd1_SColumn10: TdxDBGridColumn;
lbl6: TLabel;
cbb1_cgsh: TRxDBLookupCombo;
btn4_searchNew: TbsSkinButton;
lbl1: TLabel;
Edit1_tdh: TEdit;
lbl13: TLabel;
cbb3_qdfsh: TRxDBLookupCombo;
lbl2: TLabel;
cbb4_dyzht: TbsSkinComboBox;
dxdbgrdclmndxdbgrd1_SColumn11: TdxDBGridColumn;
btn3_cancelPrint: TbsSkinButton;
btn4_rescindPrint: TbsSkinButton;
btn1_printbat: TbsSkinButton;
dxdbgrd1_detail: TdxDBGrid;
dxdbgrdclmndxdbgrd1Column11: TdxDBGridColumn;
dxdbgrdclmndxdbgrd1Column12: TdxDBGridColumn;
iwbpdfdtr1: TiWebPDFEditor;
lbl3: TLabel;
cbb1_printstate: TbsSkinComboBox;
dxdbgrdchckclmndxdbgrd1Column13: TdxDBGridCheckColumn;
dxdbgrdchckclmndxdbgrd1_SColumn12: TdxDBGridCheckColumn;
cxchckbx1_shfhq: TcxCheckBox;
dxdbgrdmclmndxdbgrdclmndxdbgrd1_detailColumn14: TdxDBGridMemoColumn;
dxdbgrdmclmndxdbgrdclmndxdbgrd1_SColumn13: TdxDBGridMemoColumn;
btn5_submit: TbsSkinButton;
btn7Recivice: TbsSkinButton;
dxdbgrdclmndxdbgrd1_SColumn14: TdxDBGridColumn;
sp_sign_batin_id: TADOStoredProc;
dxdbgrdclmndxdbgrd1_SColumn15: TdxDBGridColumn;
dxdbgrdclmndxdbgrd1_SColumn16: TdxDBGridColumn;
dxdbgrdclmndxdbgrd1_SColumn17: TdxDBGridColumn;
dxdbgrdclmndxdbgrd1_SColumn18: TdxDBGridColumn;
dxdbgrdclmndxdbgrd1_SColumn19: TdxDBGridColumn;
ds2_print: TDataSource;
bskntbsht1: TbsSkinTabSheet;
bsknpnl3: TbsSkinPanel;
btn6_notify_exit: TbsSkinButton;
btn1_notify_search: TbsSkinButton;
btn2_notify_clear: TbsSkinButton;
btn1: TbsSkinButton;
btn2: TbsSkinButton;
bsknpnl4: TbsSkinPanel;
lbl7: TLabel;
lbl8: TLabel;
lbl9: TLabel;
lbl10: TLabel;
wdbdtmpckr1: TwwDBDateTimePicker;
wdbdtmpckr2: TwwDBDateTimePicker;
edt1_tdh: TEdit;
dxdbgrd3_notify: TdxDBGrid;
dxdbgrdclmndxdbgrd3_notifyColumn15: TdxDBGridColumn;
dxdbgrdclmn1: TdxDBGridColumn;
dxdbgrdclmn2: TdxDBGridColumn;
dxdbgrdclmn3: TdxDBGridColumn;
dxdbgrdclmn4: TdxDBGridColumn;
dxdbgrdclmn5: TdxDBGridColumn;
dxdbgrdclmn6: TdxDBGridColumn;
dxdbgrdclmn7: TdxDBGridColumn;
dxdbgrdclmn8: TdxDBGridColumn;
dxdbgrdclmn9: TdxDBGridColumn;
dxdbgrdclmn10: TdxDBGridColumn;
dxdbgrdclmn11: TdxDBGridColumn;
dxdbgrdchckclmn1: TdxDBGridCheckColumn;
dxdbgrdmclmn1: TdxDBGridMemoColumn;
dxdbgrdclmn12: TdxDBGridColumn;
qry2_paper_printlist: TADOQuery;
ds2_paper_printlist: TDataSource;
lbl11: TLabel;
cbb2_submitstate: TbsSkinComboBox;
qry1_print: TADOQuery;
dxdbgrdclmndxdbgrd3_notifyColumn16: TdxDBGridColumn;
dxdbgrdclmndxdbgrd3_notifyColumn17: TdxDBGridColumn;
dxdbgrdclmndxdbgrd3_notifyColumn18: TdxDBGridColumn;
dxdbgrdclmndxdbgrd1_SColumn20: TdxDBGridColumn;
btn3: TbsSkinButton;
ds2_crm_client_paper: TDataSource;
qry2_crm_client_paper: TADOQuery;
lbl12: TLabel;
cbb2_shipinc_paper: TRxDBLookupCombo;
cxprgrsbr1: TcxProgressBar;
dxdbgrdclmndxdbgrd1_SColumn21: TdxDBGridColumn;
dxdbgrdclmndxdbgrd1_SColumn22: TdxDBGridColumn;
bskntbsht2: TbsSkinTabSheet;
bsknpnl5: TbsSkinPanel;
btn4: TbsSkinButton;
btn5: TbsSkinButton;
btn6: TbsSkinButton;
btn7: TbsSkinButton;
btn8: TbsSkinButton;
dxdbgrd3_notiffyTask: TdxDBGrid;
dxdbgrdclmn14: TdxDBGridColumn;
dxdbgrdclmn15: TdxDBGridColumn;
dxdbgrdclmn16: TdxDBGridColumn;
dxdbgrdclmn17: TdxDBGridColumn;
dxdbgrdclmn25: TdxDBGridColumn;
dxdbgrdclmn26: TdxDBGridColumn;
dxdbgrdclmn27: TdxDBGridColumn;
dxdbgrdchckclmn2: TdxDBGridCheckColumn;
dxdbgrdclmn28: TdxDBGridColumn;
btn3_1_tasksubmit: TbsSkinButton;
btn3_2printDesign: TbsSkinButton;
btn1_RefreshTask: TbsSkinButton;
ds3_notifytask: TDataSource;
qry3_notifyTask: TADOQuery;
dxdbgrdclmndxdbgrd1_SColumn23: TdxDBGridColumn;
dxdbgrdclmndxdbgrd1_SColumn24: TdxDBGridColumn;
dxdbgrdclmndxdbgrd1_SColumn26: TdxDBGridColumn;
dxdbgrdclmndxdbgrd1_SColumn27: TdxDBGridColumn;
dxdbgrdclmndxdbgrd3_notifyColumn19: TdxDBGridColumn;
dxdbgrdclmndxdbgrd3_notifyColumn20: TdxDBGridColumn;
dxdbgrdclmndxdbgrd3_notifyColumn21: TdxDBGridColumn;
dxdbgrdclmndxdbgrd1_SColumn28: TdxDBGridColumn;
txtSelPages: TStaticText;
procedure btn4_exitClick(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure btn3_clearConditonClick(Sender: TObject);
procedure btn4_searchNewClick(Sender: TObject);
procedure N1Click(Sender: TObject);
procedure Edit3_ztdhKeyPress(Sender: TObject; var Key: Char);
procedure dxdbgrdclmndxdbgrd1xdbgrdclmndxdbgrd1Column13CustomDraw(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 dxDBGrid2Column14CustomDraw(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 MenuItem1Click(Sender: TObject);
procedure btn6_exitClick(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure btn11Click(Sender: TObject);
procedure FormResize(Sender: TObject);
procedure bsSkinButton14Click(Sender: TObject);
procedure Edit1_paperCountKeyPress(Sender: TObject; var Key: Char);
procedure btn_seach2Click(Sender: TObject);
procedure btn2_fxpageClick(Sender: TObject);
procedure btn3_cancelPrintClick(Sender: TObject);
procedure btn4_rescindPrintClick(Sender: TObject);
procedure btn1_printbatClick(Sender: TObject);
procedure dxdbgrd1_SColumnSorting(Sender: TObject;
Column: TdxDBTreeListColumn; var Allow: Boolean);
procedure btn5_submitClick(Sender: TObject);
procedure btn6_cancelSubmitClick(Sender: TObject);
procedure btn1_notify_searchClick(Sender: TObject);
procedure btn6_notify_exitClick(Sender: TObject);
procedure btn2_notify_clearClick(Sender: TObject);
procedure btn3Click(Sender: TObject);
procedure bsSkinButton4Click(Sender: TObject);
procedure btn1_RefreshTaskClick(Sender: TObject);
procedure btn3_2printDesignClick(Sender: TObject);
procedure btn3_1_tasksubmitClick(Sender: TObject);
procedure cxchckbx1_shfhqClick(Sender: TObject);
procedure dxdbgrd1_SChangeNode(Sender: TObject; OldNode,
Node: TdxTreeListNode);
procedure dxdbgrd1_SSelectedCountChange(Sender: TObject);
private
{ Private declarations }
employeePhone:string;
m_infomation:string;
m_strNo_pre,m_strNo_start,m_strNo_end:string;//<2F><>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD>ᵥҳ<E1B5A5><D2B3>ʱ<EFBFBD>ij<EFBFBD>ʼֵ
m_printTotalPages:integer; //<2F><>ӡ<EFBFBD><D3A1>ҳ<EFBFBD><D2B3>ͳ<EFBFBD><CDB3>
procedure bindPaperIn();
function genPaperno():Boolean;
procedure seachPrintList();
procedure ToOpenFile(strpath:string);
function GetPDFPages(strpath:string):Integer;
procedure DeleteChangedPrintList();
procedure DealDeletePrintFile();
function CheckBilldue():Boolean;
function PrintBilldue():Boolean;
function get_sign_batin_id:integer;
function Checksubmit():Boolean; //<2F><EFBFBD>Ѵ<EFBFBD>ӡ δ<><20><>ǩ<EFBFBD><C7A9>
function print_submit(bid:string):Boolean;
procedure seachSubmitList();
procedure seachtaskList();
public
{ Public declarations }
op:integer;
end;
var
frm_op_seae_paper_print: Tfrm_op_seae_paper_print;
implementation
uses u_main,my_sys_function, u_sys_progress;
{$R *.dfm}
/// <summary>
/// <20><>ʱĿ¼
/// </summary>
function GetWinTempPath: string;
var
TempDir: array[0..255] of char;
begin
GetTempPath(255, @TempDir);
Result := strPas(TempDir);
end;
function Tfrm_op_seae_paper_print.get_sign_batin_id:integer;
var
str:string;
aQuery:TADOQuery;
begin
Result:=0;
aQuery:=CreateAdoQuery();
str:= 'insert into t_sys_sign_batin_id ([mainorderno]) values(''1'');';
aQuery.SQL.Add(str) ;
aQuery.ExecSQL();
aQuery.sql.Clear();
str:= 'select max(signid) as sid from t_sys_sign_batin_id; ';
aQuery.sql.add(str);
aQuery.Open;
aQuery.First;
result :=aQuery.FieldByName('sid').AsInteger;
end;
procedure Tfrm_op_seae_paper_print.bindPaperIn();
var
str:string;
aQuery:TADOQuery;
begin
aQuery:=CreateAdoQuery();
with aQuery do begin
str:= 'DECLARE @RC int '
+ 'EXECUTE @RC = [p_insert_seae_paperprint_list];' ;
Close;
SQL.Clear;
SQL.Add(str);
ExecSQL();
end;
end;
procedure Tfrm_op_seae_paper_print.btn4_exitClick(Sender: TObject);
begin
Close;
end;
procedure Tfrm_op_seae_paper_print.FormShow(Sender: TObject);
begin
bsSkinPageControl1.ActivePageIndex:=0;
dxdbgrd1_S.Width:=self.ClientWidth;
bsknpnl1.Height :=34;
self.WindowState:= wsMaximized;
wwDBDateTimePicker5.Date:=Date-7;
wwDBDateTimePicker6.Date:=Date;
btn3_cancelPrint.Enabled:= if_open('443');
btn4_rescindPrint.Enabled:=if_open('444');
loadreggrid(dxdbgrd1_S,false,caption+'1');
loadreggrid(dxdbgrd1_detail,false,caption+'2');
loadreggrid(dxdbgrd3_notify,false,caption+'3');
qry_crm_client.Close();
qry_crm_client.Open;
qry2_crm_client_paper.Active:=False;
qry2_crm_client_paper.Active:=True;
seachPrintList();
seachSubmitList();
end;
procedure Tfrm_op_seae_paper_print.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
// pdfctvx1. FPDF_ExitAppActiveX ();
savereggrid(dxdbgrd1_S,caption+'1');
savereggrid(dxdbgrd1_detail,caption+'2');
savereggrid(dxdbgrd3_notify,caption+'3');
frm_op_seae_paper_print.Hide;
frm_op_seae_paper_print.ManualFloat(frm_op_seae_paper_print.BoundsRect );
frm_main.freeTabs('frm_op_seae_paper_print');
action:=cafree;
frm_op_seae_paper_print:=nil;
end;
procedure Tfrm_op_seae_paper_print.btn3_clearConditonClick(Sender: TObject);
begin
//Edit1_ywbh.text:='';
//Edit2_wtbh.text:='';
end;
function replaceSQuotes(txt: string):string;
begin
result:=stringreplace(txt,'''','''''',[rfReplaceAll]);
end;
procedure Tfrm_op_seae_paper_print.btn4_searchNewClick(Sender: TObject);
begin
//
try
if ((cbb4_dyzht.Text='<<3C><>>') or (cbb4_dyzht.Text='δ<><CEB4>ӡ') ) then
begin
//<2F><><EFBFBD><EFBFBD>̨<EFBFBD><CCA8><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD>
DeleteChangedPrintList();
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɾ<EFBFBD><C9BE><EFBFBD>Ĺ<EFBFBD>˾<EFBFBD>ҵ<EFBFBD><D2B5>ļ<EFBFBD>
DealDeletePrintFile();
//<2F><><EFBFBD><EFBFBD>̨<EFBFBD><CCA8>
bindPaperIn();
//<2F><><EFBFBD><EFBFBD>ҳ<EFBFBD><D2B3>
genPaperno();
end;
//<2F><>ʾ<EFBFBD>б<EFBFBD>
seachPrintList();
except
on ex:exception do
begin
errorlog(ex.Message) ;
Application.MessageBox(PChar('<27><EFBFBD><ECB3A3><EFBFBD><EFBFBD>:'+EX.Message),'',MB_ICONWARNING);
end;
end;
end;
procedure Tfrm_op_seae_paper_print.btn1_printbatClick(Sender: TObject);
begin
try
qry1_paper_printlist.DisableControls;
qry_crm_client.DisableControls;
iwbpdfdtr1.IsOpenVerify:=false;
iwbpdfdtr1.VerifySigner:=False;
try
if CheckBilldue() then
begin
cxprgrsbr1.Visible:=True;
cxprgrsbr1.Position:=0;
//<2F><>ӡ
PrintBilldue();
qry_crm_client.Active:=false;
qry_crm_client.Active:=true;
seachPrintList();
end;
except
ON ex:Exception do
begin
//
errorlog(ex.Message) ;
Application.MessageBox(PChar('<27><EFBFBD><ECB3A3><EFBFBD><EFBFBD>:'+EX.Message),'',MB_ICONWARNING);
end;
end;
finally
iwbpdfdtr1.IsOpenVerify:=true;
cxprgrsbr1.Visible:=False;
qry_crm_client.EnableControls;
qry1_paper_printlist.EnableControls;
end;
end;
/// <summary>
/// <20><><EFBFBD><EFBFBD>˾ / <20><EFBFBD><E1B5A5><EFBFBD><EFBFBD> / ǩ<><C7A9><EFBFBD><EFBFBD>ʽ/ <20><>ǩ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E4BBAF><EFBFBD><EFBFBD>
/// </summary>
procedure Tfrm_op_seae_paper_print.DeleteChangedPrintList();
var
str:string;
begin
str:='DECLARE @return_value int' +#13
+' EXEC @return_value = [dbo].[p_delete_seae_paper_printlist_onchange] '
+'SELECT ''Return Value'' = @return_value ';
try
frm_main.db.Execute(str);
except
on ex:Exception do
errorlog(ex.message);
end;
end;
/// <summary>
/// <20>ϴ<EFBFBD><CFB4>ļ<EFBFBD>ɾ<EFBFBD><C9BE><EFBFBD>Ľ<EFBFBD><C4BD>б<EFBFBD><D0B1><EFBFBD>
/// </summary>
procedure Tfrm_op_seae_paper_print.DealDeletePrintFile();
var
str:string;
begin
//
try
str:='update t_op_seae_paper_print_list set <20><>ӡ״̬=''<27>ļ<EFBFBD><C4BC>쳣'',<2C><>ע=''<27>ļ<EFBFBD><C4BC>ѱ<EFBFBD>ɾ<EFBFBD><C9BE>'''
+' where <20><>ӡ״̬ in (''δ<><CEB4>ӡ'',''ȡ<><C8A1><EFBFBD><EFBFBD>ӡ'') and exists ('
+'SELECT [<5B><><EFBFBD><EFBFBD>]FROM [v_op_seaep_paper_print_errfile] v where v.<2E><><EFBFBD><EFBFBD>=t_op_seae_paper_print_list.<2E><><EFBFBD><EFBFBD> '
+' )' ;
frm_main.db.Execute(str);
except
on ex:Exception do
begin
errorlog(ex.Message) ;
end;
end;
end;
/// <summary>
/// <20><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>
/// </summary>
function Tfrm_op_seae_paper_print.CheckBilldue():Boolean;
var
strxhs,strMainOrder,cgsh1,cgsh2,printState,strfilename,str,strInfo,strtmp,strPagechangeInfo:string;
i,itmp,i_tdpages,i_fxpages,iSelcount :integer;
blNeedAnalyze:Boolean;
aQuery:TADOQuery;
begin
{
//<2F><><EFBFBD><EFBFBD>˳<EFBFBD><CBB3>
str:='';
for i:=0 to dxdbgrd1_S.SelectedCount-1 do
begin
qry1_paper_printlist.GoTobookmark(pointer(dxdbgrd1_S.SelectedRows[i]));
str:= str+#13+ qry1_paper_printlist.FieldByName('<27><><EFBFBD><EFBFBD><E1B5A5>').AsString;
end;
ShowMessage(str);
}
str:='';
//1.<2E>жϴ<D0B6><CFB4><EFBFBD>˾<EFBFBD>Ƿ<EFBFBD>һ<EFBFBD><D2BB>
//2.ѡ<><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD>ǿ<EFBFBD><C7BF>Դ<EFBFBD>ӡ<EFBFBD><D3A1><EFBFBD>
//3.<2E>ж<EFBFBD><D0B6>ļ<EFBFBD><C4BC>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>
//4.У<><D0A3><EFBFBD><EFBFBD>ӡ<EFBFBD><D3A1><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD>һ<EFBFBD><D2BB>:<3A><><EFBFBD><EFBFBD><EFBFBD>͸<EFBFBD><CDB8><EFBFBD> doing
blNeedAnalyze:=False;//<2F>Ƿ<EFBFBD><C7B7><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD>·<EFBFBD><C2B7><EFBFBD>
Result:=true;
m_printTotalPages:=0;
strxhs:='-54321';
iSelcount:= dxdbgrd1_S.SelectedCount;
for i:=0 to dxdbgrd1_S.SelectedCount-1 do
begin
qry1_paper_printlist.GoTobookmark(pointer(dxdbgrd1_S.SelectedRows[i]));
itmp:= qry1_paper_printlist.FieldByName('<27><>Ҫ<EFBFBD>ᵥֽ<E1B5A5><D6BD><EFBFBD><EFBFBD>').AsInteger;
strfilename:= qry1_paper_printlist.FieldByName('<27><><EFBFBD><EFBFBD>').AsString;
strMainOrder:= qry1_paper_printlist.FieldByName('<27><><EFBFBD><EFBFBD><E1B5A5>').AsString;
//
m_printTotalPages:=m_printTotalPages+itmp;
if i=0 then
begin
cgsh1 := qry1_paper_printlist.FieldByName('<27><><EFBFBD><EFBFBD>˾').AsString;
cgsh2:=cgsh1;
end
else
begin
cgsh2 := qry1_paper_printlist.FieldByName('<27><><EFBFBD><EFBFBD>˾').AsString;
end;
//
if cgsh1<>cgsh2 then
begin
showmessage('<27><><EFBFBD><EFBFBD>˾<EFBFBD><CBBE>Ψһ!');
Result:=false;
Exit;
end;
printState:=qry1_paper_printlist.FieldByName('<27><>ӡ״̬').AsString;
if (printState<>'δ<><CEB4>ӡ') and (printState<>'ȡ<><C8A1><EFBFBD><EFBFBD>ӡ') then
begin
showmessage('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӡ<EFBFBD>б<EFBFBD><D0B1><EFBFBD>ȫ<EFBFBD><C8AB><EFBFBD><EFBFBD>δ<EFBFBD><CEB4>ӡ(<28><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>ӡ)<29><><EFBFBD>ᵥ!');
Result:=false;
Exit;
end;
//У<><D0A3><EFBFBD>ļ<EFBFBD>ҳ<EFBFBD><D2B3><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
if(blNeedAnalyze=false) then
begin
i_tdpages:= qry1_paper_printlist.FieldByName('<27>ᵥҳ<E1B5A5><D2B3>').AsInteger;
i_fxpages:= GetPDFPages(strfilename);
if(i_tdpages<>i_fxpages) then
begin
blNeedAnalyze:=true;
strPagechangeInfo:='<27>ᵥ[' +strmainorder+']<5D><><EFBFBD>ᵥҳ<E1B5A5><D2B3><EFBFBD>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>仯:'
+inttostr(i_tdpages)+'>>' + IntToStr(i_fxpages) +',<2C><>Ҫ<EFBFBD><D2AA><EFBFBD>·<EFBFBD><C2B7><EFBFBD>!' ;
end;
end;
strtmp:= qry1_paper_printlist.FieldByName('<27><><EFBFBD><EFBFBD>').AsString;
if(not FileExists(strfilename)) then
begin
Result:=false;
strInfo:='<27>ᵥ['+ strMainOrder
+']<5D>Ĵ<EFBFBD><C4B4><EFBFBD>˾<EFBFBD>ҵ<EFBFBD><D2B5>ļ<EFBFBD>'+strfilename +'<27>Ѳ<EFBFBD><D1B2><EFBFBD><EFBFBD>ڻ<EFBFBD><DABB><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>ɷ<EFBFBD><C9B7><EFBFBD>!<21><><EFBFBD>ܴ<EFBFBD>ӡ!'
+#13+'<27>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD>Ǹ<EFBFBD>̨<EFBFBD><CCA8>"<22>ļ<EFBFBD><C4BC>쳣"?' + #13 +'<27><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><ECB3A3>,<2C><>ǰ<EFBFBD><EFBFBD><E1B5A5>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD>ܴ<EFBFBD>ӡ!'
+'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӡ<EFBFBD><D3A1>ɾ<EFBFBD><C9BE>ԭ<EFBFBD><D4AD><EFBFBD>ļ<EFBFBD>¼,<2C><><EFBFBD><EFBFBD><EFBFBD>ò<EFBFBD>ͬ<EFBFBD><CDAC><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD>ϴ<EFBFBD><CFB4><EFBFBD><EFBFBD>ٽ<EFBFBD><D9BD>д<EFBFBD>ӡ';
IF Application.MessageBox(PChar(strInfo),'<27><>Ϣ<EFBFBD><CFA2>ʾ',MB_ICONQUESTION+MB_YESNO)=ID_YES then
begin
str:='update t_op_seae_paper_print_list set <20><>ӡ״̬=''<27>ļ<EFBFBD><C4BC>쳣'',<2C><>ע=''<27>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڻ<EFBFBD><DABB>߲<EFBFBD><DFB2>ɷ<EFBFBD><C9B7><EFBFBD>'' '
+'where <20><><EFBFBD><EFBFBD>= ' + strtmp +';' ;
frm_main.db.Execute(str);
seachPrintList();
END;
Result:=false;
Exit;
end;
strxhs:= strxhs+',' +strtmp;
end;
//ҳ<><D2B3><EFBFBD><EFBFBD><E4BBAF><EFBFBD><EFBFBD>
if ( blNeedAnalyze) then
begin
// strPagechangeInfo
Result:=false;
Application.MessageBox(PChar(strPagechangeInfo),'<27><>Ϣ<EFBFBD><CFA2>ʾ',MB_ICONINFORMATION+MB_OK);
str:='update t_op_seae_paper_print_list set [<5B>Ƿ<EFBFBD><C7B7>ѷ<EFBFBD><D1B7><EFBFBD>]=0 where <20><><EFBFBD><EFBFBD> in ('+ strxhs + ' ); ' ;
frm_main.db.Execute(str);
genPaperno();
seachPrintList();
Exit;
end;
//<2F><EFBFBD><E1B5A5><EFBFBD>Ѵ<EFBFBD>ӡ<EFBFBD><D3A1><EFBFBD><EFBFBD>
str:='select <20><><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD><E1B5A5>,<2C><>ӡ<EFBFBD><D3A1><EFBFBD><EFBFBD> from t_op_seae_paper_print_list p where p.<2E><>ӡ״̬=''<27>Ѵ<EFBFBD>ӡ'' '
+' and <20><><EFBFBD><EFBFBD><E1B5A5> in ( select <20><><EFBFBD><EFBFBD><E1B5A5> from t_op_seae_paper_print_list p0 where <20><><EFBFBD><EFBFBD> in ('+ strxhs + ') ) ' ;
aQuery:=CreateAdoQuery();
aQuery.Close;
aQuery.SQL.Clear;
aQuery.SQL.Add(str);
aQuery.Open;
if not aQuery.IsEmpty then
begin
strInfo:='';
aQuery.First;
while not aQuery.Eof do
begin
strInfo := strInfo+ '<27><EFBFBD><E1B5A5>:'+ aQuery.fieldbyname('<27><><EFBFBD><EFBFBD><E1B5A5>').AsString
+',<2C><>ӡ<EFBFBD><D3A1><EFBFBD><EFBFBD>:' + aQuery.fieldbyname('<27><>ӡ<EFBFBD><D3A1><EFBFBD><EFBFBD>').AsString +#13;
aQuery.Next;
end;
if( iSelcount>1) then
begin
result:=false;
strInfo:= '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӡ<EFBFBD>к<EFBFBD><D0BA><EFBFBD><EFBFBD>Ѵ<EFBFBD>ӡ<EFBFBD><D3A1><EFBFBD>ᵥ,<2C><>ȷ<EFBFBD>Ϻ<EFBFBD><CFBA>ٽ<EFBFBD><D9BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӡ:'+#13#10
+ strinfo;
Application.MessageBox(PChar(strInfo),'<27><>Ϣ<EFBFBD><CFA2>ʾ',MB_ICONINFORMATION);
end
else
begin
strInfo:= 'ѡ<><D1A1><EFBFBD><EFBFBD><E1B5A5><EFBFBD>Ѵ<EFBFBD>ӡ,<2C><>ȷʵҪ<CAB5><D2AA>ӡ<EFBFBD><D3A1><EFBFBD><EFBFBD><E1B5A5>:'+#13#10 + strinfo;
IF Application.MessageBox(PChar(strInfo),'<27><>Ϣ<EFBFBD><CFA2>ʾ',MB_ICONQUESTION+MB_YESNO) <>ID_YES then
begin
Result:=false;
END;
end;
end;
exit;
//sql
strtmp:='select * from '
+'( SELECT [<5B><><EFBFBD><EFBFBD>],p.[<5B><><EFBFBD><EFBFBD>],p.[<5B><><EFBFBD><EFBFBD><E1B5A5>],p.[<5B><><EFBFBD><EFBFBD>˾]'
+' ,p.[ǩ<><C7A9><EFBFBD><EFBFBD>ʽ],p.[<5B><><EFBFBD><EFBFBD>],p.[<5B><EFBFBD><E1B5A5><EFBFBD><EFBFBD>],p.[<5B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E1B5A5><EFBFBD><EFBFBD>],p.[<5B><><EFBFBD><EFBFBD>],'
+' case when p.[<5B><><EFBFBD><EFBFBD>˾]=sea.[<5B><><EFBFBD><EFBFBD>˾] then 0 else 1 end as <20><><EFBFBD><EFBFBD>˾err,'
+' case p.<2E><EFBFBD><E1B5A5><EFBFBD><EFBFBD>-'
+' case sea.[<5B><EFBFBD><E1B5A5><EFBFBD><EFBFBD>] when ''ONE'' then 1 when ''TWO'' then 2 when ''THREE'' then 3'
+' when ''FOUR'' then 4 when ''FIVE'' then 5 when ''SIX'' then 6 when ''SEVEN'' then 7'
+' when ''EIGHT'' then 8 when ''NINE'' then 9 when ''TEN'' then 10 else 0 end '
+' when 0 then 0 else 1 end as [<5B><EFBFBD><E1B5A5><EFBFBD><EFBFBD>err] ,'
+' case p.[<5B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E1B5A5><EFBFBD><EFBFBD>]-'
+' case sea.[<5B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E1B5A5><EFBFBD><EFBFBD>] when ''ONE'' then 1 when ''TWO'' then 2 when ''THREE'' then 3'
+' when ''FOUR'' then 4 when ''FIVE'' then 5 when ''SIX'' then 6 when ''SEVEN'' then 7'
+' when ''EIGHT'' then 8 when ''NINE'' then 9 when ''TEN'' then 10 else 0 end'
+' when 0 then 0 else 1 end as [<5B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E1B5A5><EFBFBD><EFBFBD>err] , '
+' case when isnull(p.[<5B>Ƿ<EFBFBD><C7B7><EFBFBD>ǩ],0)=isnull(sea.[<5B>Ƿ<EFBFBD><C7B7><EFBFBD>ǩ],0) then 0 else 1 end as <20>Ƿ<EFBFBD><C7B7><EFBFBD>ǩerr ,'
+' case when p.ǩ<><C7A9><EFBFBD><EFBFBD>ʽ=sea.ǩ<><C7A9><EFBFBD><EFBFBD>ʽ then 0 else 1 end as ǩ<><C7A9><EFBFBD><EFBFBD>ʽerr'
+' FROM ( select * from [t_op_seae_paper_print_list] where <20><><EFBFBD><EFBFBD> in('+ strxhs +') ) '
+' left join t_op_seae sea on p.<2E><><EFBFBD><EFBFBD>=sea.<2E><><EFBFBD><EFBFBD>'
+' ) v where (v.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E1B5A5><EFBFBD><EFBFBD>err+v.<2E><EFBFBD><E1B5A5><EFBFBD><EFBFBD>err+v.<2E>Ƿ<EFBFBD><C7B7><EFBFBD>ǩerr+v.ǩ<><C7A9><EFBFBD><EFBFBD>ʽerr+v.<2E><><EFBFBD><EFBFBD>˾err)>0'
+''
+''
+'';
aQuery:=CreateAdoQuery();
with aQuery do begin
Close();
SQL.Clear;
SQL.Add(strtmp);
Open;
First;
if (not IsEmpty) then
begin
strInfo:='';
while not Eof do
begin
//
//strInfo:= strInfo+'<27><EFBFBD><E1B5A5>Ϊ[' +fieldbyname('<27><><EFBFBD><EFBFBD><E1B5A5>')+
end;
end;
end;
end; //end CheckBilldue
/// <summary>
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӡ
/// </summary>
function Tfrm_op_seae_paper_print.PrintBilldue():boolean;
var
str,cgsh1,cgsh2,strtmp,strtdbh,strdyxh,strtdh2,strinoTmp:string;
ipages,itmp,i,j,im,icount:Integer;
m_infomation,strfile,printState,strerr,xhs:string;
aQuery,aQueryUpdate:TADOQuery;
lcfile:string;
//
inifile1:Tinifile;
inifile_name:string;
rederpath: string;
hasreader:Boolean;
paperStartNo:string; //<2F>ᵥ:<3A>ᵥֽ<E1B5A5><D6BD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>
paperEndNo:string;// <20>ᵥ:<3A>ᵥֽ<E1B5A5><D6BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
begin
strinoTmp:='';//debug
aQuery:=CreateAdoQuery();
aQueryUpdate:=CreateAdoQuery();
m_infomation:='';
ipages:=0;
itmp:=0;
strinoTmp:='';
icount:= dxdbgrd1_S.SelectedCount;
//
inifile_name:=ExtractFilePath(application.ExeName)+'pdfread.ini';
hasreader:=false;
if(FileExists(inifile_name ) ) then
begin
inifile1:=Tinifile.Create(inifile_name);
rederpath:= inifile1.ReadString('pdf','pdfreaderpath','');
if( FileExists(PChar(rederpath)) ) then
hasreader:=True
else
begin
ShowMessage('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"'+inifile_name+'"<22>ļ<EFBFBD><C4BC>е<EFBFBD>foxit read ·<><C2B7>!');
Exit;
end;
end;
for i:=0 to dxdbgrd1_S.SelectedCount-1 do
begin
qry1_paper_printlist.GoTobookmark(pointer(dxdbgrd1_S.SelectedRows[i]));
itmp:= qry1_paper_printlist.FieldByName('<27><>Ҫ<EFBFBD>ᵥֽ<E1B5A5><D6BD><EFBFBD><EFBFBD>').AsInteger;
//1 <20><>¼<EFBFBD><C2BC>ϸ
strtdbh :=qry1_paper_printlist.FieldByName('<27><><EFBFBD><EFBFBD>').AsString;
strtdh2 := qry1_paper_printlist.FieldByName('<27><><EFBFBD><EFBFBD><E1B5A5>').AsString;
strfile:= qry1_paper_printlist.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString;
//strinoTmp:=strinoTmp+':'+ strtdh2+':'+ strtdbh +':'+ strfile +#13#10;
//
ipages:=ipages+itmp;
if i=0 then
begin
cgsh1 := qry1_paper_printlist.FieldByName('<27><><EFBFBD><EFBFBD>˾').AsString;
cgsh2:=cgsh1;
end
else
begin
cgsh2 := qry1_paper_printlist.FieldByName('<27><><EFBFBD><EFBFBD>˾').AsString;
end;
//
if cgsh1<>cgsh2 then
begin
showmessage('<27><><EFBFBD><EFBFBD>˾<EFBFBD><CBBE>Ψһ!');
Exit;
end;
printState:=qry1_paper_printlist.FieldByName('<27><>ӡ״̬').AsString;
if (printState<>'δ<><CEB4>ӡ') and (printState<>'ȡ<><C8A1><EFBFBD><EFBFBD>ӡ') and (printState<>'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>') then
begin
showmessage('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӡ<EFBFBD>б<EFBFBD><D0B1><EFBFBD>ȫ<EFBFBD><C8AB><EFBFBD><EFBFBD>δ<EFBFBD><CEB4>ӡ<EFBFBD>ᵥ!');
Exit;
end;
//qry1_paper_printlist.Next;
end;
//<2F>ж<EFBFBD>ֽ<EFBFBD><D6BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ,<2C><>locate
if( qry_crm_client.Locate('<27><><EFBFBD><EFBFBD>˾<EFBFBD><CBBE><EFBFBD><EFBFBD>',cgsh1,[loCaseInsensitive])) then
strtmp:= qry_crm_client.FieldByName('<27><><EFBFBD><EFBFBD>˾<EFBFBD><CBBE><EFBFBD><EFBFBD>').AsString
else
with qry_crm_client DO
begin
First;
While Not EOF Do {<7B>Ա<EFBFBD><D4B1><EFBFBD>ȫ<EFBFBD><C8AB><EFBFBD><EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>}
begin
strtmp:= FieldByName('<27><><EFBFBD><EFBFBD>˾<EFBFBD><CBBE><EFBFBD><EFBFBD>').AsString;
if(strtmp=cgsh1) then
begin
break;
end;
Next;
end;
// ShowMessage(strinoTmp);
//
end;
if(strtmp<>cgsh1) then
begin
Application.MessageBox( PChar('ֻ<><D6BB>ѡ<EFBFBD><D1A1>һ<EFBFBD>ҹ<EFBFBD>˾<EFBFBD>ĵ<EFBFBD><C4B5>ᵥ!'),'<27><>Ϣ<EFBFBD><CFA2>ʾ',MB_ICONINFORMATION) ;
Exit;
end;
itmp:= qry_crm_client.fieldbyname('<27>ᵥֽʣ<D6BD><CAA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsInteger;
if(itmp<ipages) then
begin
m_infomation:= strtmp+'<27><><EFBFBD><EFBFBD><EFBFBD>ᵥֽ<E1B5A5><D6BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<2C><>ӡ<EFBFBD><D3A1>Ҫ<EFBFBD>ᵥֽ'
+inttostr(ipages)+'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ'+ inttostr(itmp) + '<27><><EFBFBD><EFBFBD><EFBFBD>Ƚ<EFBFBD><C8BD><EFBFBD><EFBFBD>ᵥֽ<E1B5A5><D6BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1>' ;
Application.MessageBox( PChar(m_infomation),'<27><>Ϣ<EFBFBD><CFA2>ʾ',MB_ICONINFORMATION) ;
Exit;
end;
//ȡ<>ô<EFBFBD>ӡֽ
if(qry_crm_client.fieldbyname('<27>ᵥֽ<E1B5A5>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>').AsBoolean) then
begin
//ȡ<><C8A1>ֽ<EFBFBD><D6BD>
if(qry_crm_client.fieldbyname('ֽ<><D6BD>ʹ<EFBFBD><CAB9><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>').AsBoolean) then
str:='select <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, f_max+''<27><><EFBFBD><EFBFBD>''+ f_min as f_info,f_count from ' +#13#10
+' ( select <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, max(<28>ᵥֽ<E1B5A5><D6BD>)as f_max, min(<28>ᵥֽ<E1B5A5><D6BD>) as f_min , COUNT(1) as f_count ' +#13#10
+' from ( SELECT TOP ' + IntToStr(ipages) + ' * FROM [t_op_seae_paper_detail] '
+' where <20><><EFBFBD><EFBFBD>˾<EFBFBD><CBBE><EFBFBD><EFBFBD>='''+cgsh1 +''' and ʹ<><CAB9>״̬ is null order by <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> , <20>ᵥֽ<E1B5A5><D6BD> desc ' +#13#10
+' ) V GROUP BY <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ' +#13#10
+' )v1 '
else
str:='select min(<28>ᵥֽ<E1B5A5><D6BD>) +''<27><><EFBFBD><EFBFBD>''+ max(<28>ᵥֽ<E1B5A5><D6BD>) as f_info ,COUNT(1) as f_count'
+' from ( SELECT TOP ' + IntToStr(ipages) + ' * FROM [t_op_seae_paper_detail]'
+' where <20><><EFBFBD><EFBFBD>˾<EFBFBD><CBBE><EFBFBD><EFBFBD>='''+cgsh1 +''' and ʹ<><CAB9>״̬ is null order by <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<2C>ᵥֽ<E1B5A5><D6BD> '
+')v';
with aQuery do begin
Close;
SQL.Clear;
SQL.Add(str);
Open;
First;
if(qry_crm_client.fieldbyname('ֽ<><D6BD>ʹ<EFBFBD><CAB9><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>').AsBoolean=false) then
m_infomation:='<27><><EFBFBD><EFBFBD>'+cgsh1+'<27>հ<EFBFBD><D5B0><EFBFBD><E1B5A5><EFBFBD><EFBFBD>Ϊ'+ fieldbyname('f_info').AsString
+'<27>ᵥֽ'+ IntToStr(ipages) +'<27>ŷ<EFBFBD><C5B7><EFBFBD><EFBFBD><EFBFBD>ӡ<EFBFBD><D3A1>,<2C>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD>ڽ<EFBFBD><DABD>д<EFBFBD>ӡ?'
else
begin
m_infomation:='';
while not Eof do begin
m_infomation:= m_infomation + fieldbyname('f_info').AsString
+'<27>ᵥֽ'+ fieldbyname('f_count').AsString +'<27><>'+#13#10 ;
Next;
end;
m_infomation := '<27><><EFBFBD><EFBFBD>'+cgsh1+'<27>հ<EFBFBD><D5B0><EFBFBD><E1B5A5><EFBFBD><EFBFBD>Ϊ'+ m_infomation
+ '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӡ<EFBFBD><D3A1>,<2C>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD>ڽ<EFBFBD><DABD>д<EFBFBD>ӡ?'
end;
if(Application.MessageBox(pchar(m_infomation),'<27><>Ϣ<EFBFBD><CFA2>ʾ', MB_ICONQUESTION+MB_YESNO) <> ID_YES) then
Exit;
//msk
end;
//BBBBBBBBBBBBBBB
aQuery.Close;
aQuery.SQL.Clear;
if(qry_crm_client.fieldbyname('ֽ<><D6BD>ʹ<EFBFBD><CAB9><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>').AsBoolean) then
str:='SELECT TOP ' + IntToStr(ipages) + ' * FROM [t_op_seae_paper_detail] '
+' where <20><><EFBFBD><EFBFBD>˾<EFBFBD><CBBE><EFBFBD><EFBFBD>=''' +cgsh1+ ''' and ʹ<><CAB9>״̬ is null order by <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> , <20>ᵥֽ<E1B5A5><D6BD> desc '
else
str:='SELECT TOP ' + IntToStr(ipages) + ' * FROM [t_op_seae_paper_detail] '
+' where <20><><EFBFBD><EFBFBD>˾<EFBFBD><CBBE><EFBFBD><EFBFBD>=''' +cgsh1+ ''' and ʹ<><CAB9>״̬ is null order by <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> , <20>ᵥֽ<E1B5A5><D6BD> ';
aQuery.SQL.Add(str);
aQuery.Open;
aQuery.First;
strinoTmp:='';
xhs:='-1234';
for i:=0 to dxdbgrd1_S.SelectedCount-1 do //<2F>ᵥѭ<E1B5A5><D1AD>
begin //for begin
// <20>ı<EFBFBD>״̬<D7B4><CCAC><EFBFBD>¿<EFBFBD><C2BF><EFBFBD>
qry1_paper_printlist.GoTobookmark(pointer(dxdbgrd1_S.SelectedRows[i]));
itmp:= qry1_paper_printlist.FieldByName('<27><>Ҫ<EFBFBD>ᵥֽ<E1B5A5><D6BD><EFBFBD><EFBFBD>').AsInteger;
xhs:=xhs+','+ qry1_paper_printlist.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString;
//1 <20><>¼<EFBFBD><C2BC>ϸ
strdyxh:=qry1_paper_printlist.FieldByName('<27><><EFBFBD><EFBFBD>').AsString;
strtdbh :=qry1_paper_printlist.FieldByName('<27><><EFBFBD><EFBFBD>').AsString;
strtdh2 := qry1_paper_printlist.FieldByName('<27><><EFBFBD><EFBFBD><E1B5A5>').AsString;
strfile:= qry1_paper_printlist.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString;
// strinoTmp:=strinoTmp+':'+ strtdh2+':'+ strtdbh +':'+ strfile +#13#10;
if(itmp<1) then begin
//
Continue;
end;
try
frm_main.db.BeginTrans;
for j:=1 to itmp do begin
aQuery.Edit;//<2F><EFBFBD><E0BCAD>ϸ
if(j=1) then
begin
paperStartNo:=aQuery.fieldbyname('<27>ᵥֽ<E1B5A5><D6BD>').AsString;
paperEndNo:= aQuery.fieldbyname('<27>ᵥֽ<E1B5A5><D6BD>').AsString;
end
else
paperEndNo:= aQuery.fieldbyname('<27>ᵥֽ<E1B5A5><D6BD>').AsString;
aQuery.fieldbyname('<27><EFBFBD><E1B5A5><EFBFBD><EFBFBD>').AsString :=strtdbh;
aQuery.fieldbyname('<27><EFBFBD><E1B5A5>').AsString := strtdh2;
aQuery.fieldbyname('ҳ<><D2B3>').asinteger :=j;
aQuery.fieldbyname('<27><>ҳ<EFBFBD><D2B3>').asinteger := itmp;
aQuery.fieldbyname('ʹ<><CAB9>״̬').AsString :='<27>Ѵ<EFBFBD>ӡ';
aQuery.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString := employee;
aQuery.fieldbyname('<27><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>').AsDateTime :=GetDbDatetime;
aQuery.fieldbyname('<27><>ӡ̨<D3A1><CCA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asinteger
:=qry1_paper_printlist.FieldByName('<27><><EFBFBD><EFBFBD>').asinteger;
aQuery.next ;
end;
//3b<33>޸<EFBFBD><DEB8><EFBFBD><EFBFBD><EFBFBD>
//2.<2E>ı<EFBFBD>״̬
str:='update t_op_seae_paper_print_list set '
+' <20><>ӡ״̬=''<27>Ѵ<EFBFBD>ӡ'',<2C><>ӡ<EFBFBD><D3A1>='''+employee
+ ''',<2C><>ӡ<EFBFBD><D3A1><EFBFBD><EFBFBD>='''+ FormatDateTime('yyyy-mm-dd hh:mm:ss',GetDbDatetime)
+''' ,<2C>ᵥֽ<E1B5A5><D6BD>ʼ<EFBFBD><CABC>='''+paperstartno + ''',<2C>ᵥֽ<E1B5A5><D6BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>='''+paperendno+''' '
+'where <20><><EFBFBD><EFBFBD> =' +strdyxh+' ';
aQueryUpdate.Close;
aQueryUpdate.SQL.Clear;
aQueryUpdate.SQL.Add(str);
aQueryUpdate.ExecSQL;
aQueryUpdate.Close;
aQueryUpdate.SQL.Clear;
aQueryUpdate.SQL.Add('UPDATE [t_op_seae_paper_shipinc] '
+ ' SET [<5B>ᵥֽʣ<D6BD><CAA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>] = <20>ᵥֽʣ<D6BD><CAA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>- '+inttostr(itmp )
+ ' WHERE [<5B><><EFBFBD><EFBFBD>˾<EFBFBD><CBBE><EFBFBD><EFBFBD>] = ''' + cgsh1 +'''');
aQueryUpdate.ExecSQL;
frm_main.db.CommitTrans;
except on ex:Exception do
begin
frm_main.db.RollbackTrans;
m_infomation:='<27><>ӡ<EFBFBD><EFBFBD><E1B5A5><EFBFBD><EFBFBD><EFBFBD>쳣:'+ex.Message +'!';
Application.MessageBox(PChar(m_infomation),'<27><>Ϣ<EFBFBD><CFA2>ʾ',MB_ICONINFORMATION);
end;
end;//edn try
// /.<2E><><EFBFBD>ݴ<EFBFBD>ӡ
try
for im:=1 to qry1_paper_printlist.fieldbyname('<27><><EFBFBD><EFBFBD>').asinteger do begin
lcfile:= GetWinTempPath()+ trim(strdyxh) + '.PDF';
CopyFile(pChar(strfile),pChar(lcfile),false);
// ShowMessage(lcfile);
{
AcroPDF1.src:=strfile;
AcroPDF1.LoadFile(strfile);
AcroPDF1.Print;
}
// lcfile:=strfile;
if(hasreader) then
ShellExecute(Self.Handle,'open',PChar( rederpath) ,PChar(' -p '+lcfile ) , nil, SW_HIDE)
else
ShellExecute(Self.Handle,'print',PChar(lcfile),nil, nil, SW_HIDE) ;
sleep(2000);
end;
except
on ex:Exception do begin
errorlog(ex.Message) ;
m_infomation:='<27><>ӡ<EFBFBD><EFBFBD><E1B5A5><EFBFBD><EFBFBD><EFBFBD>쳣:'+ex.Message +'!';
Application.MessageBox(PChar(m_infomation),'<27><>Ϣ<EFBFBD><CFA2>ʾ',MB_ICONINFORMATION);
Break;
end;
end;
cxprgrsbr1.Position:= Round(100*((i+1)/icount) ) ;
cxprgrsbr1.Refresh;
sleep(2000);
//EEEEEEEEEEEEEEEEEEE
end; //for end
qry_crm_client.close();
qry_crm_client.open;
exit; //<2F>ᵥֽ<E1B5A5>б<EFBFBD><D0B1>ŵĴ<C5B5><C4B4><EFBFBD>
end ;
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˾ û<><C3BB>ֽ<EFBFBD>ű<EFBFBD><C5B1>ŵĵ<C5B5>
m_infomation:='<27>뽫'+ IntToStr(ipages)+'<27>ſհ<C5BF>'+cgsh1 +'<27>ᵥֽ<E1B5A5><D6BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӡ<EFBFBD><D3A1>,<2C>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD>ڽ<EFBFBD><DABD>д<EFBFBD>ӡ?';
if(Application.MessageBox(PChar(m_infomation),'<27><>Ϣ<EFBFBD><CFA2>ʾ',MB_ICONQUESTION+MB_YESNO) <> ID_YES) then
Exit;
//BBBBBBBBBBBBBBB 222222
for i:=0 to dxdbgrd1_S.SelectedCount-1 do //<2F>ᵥѭ<E1B5A5><D1AD>
begin
xhs:=xhs+','+ qry1_paper_printlist.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString;
qry1_paper_printlist.GoTobookmark(pointer(dxdbgrd1_S.SelectedRows[i]));
itmp:= qry1_paper_printlist.FieldByName('<27><>Ҫ<EFBFBD>ᵥֽ<E1B5A5><D6BD><EFBFBD><EFBFBD>').AsInteger;
xhs:=xhs+','+ qry1_paper_printlist.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString;
//1 <20><>¼<EFBFBD><C2BC>
//aQuery.post;
//2.<2E>ı<EFBFBD>״̬
strdyxh:=qry1_paper_printlist.FieldByName('<27><><EFBFBD><EFBFBD>').AsString;
strtdbh:=qry1_paper_printlist.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString;
strfile:= qry1_paper_printlist.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString;
lcfile:= GetWinTempPath()+trim(strtdbh)+'_'+ IntToStr(Random(20))+ '.PDF';
CopyFile(pChar(strfile),pChar(lcfile),false);
// lcfile:=strfile;
/////////////////////////////
strtdbh :=qry1_paper_printlist.FieldByName('<27><><EFBFBD><EFBFBD>').AsString;
strtdh2 := qry1_paper_printlist.FieldByName('<27><><EFBFBD><EFBFBD><E1B5A5>').AsString;
strfile:= qry1_paper_printlist.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString;
// strinoTmp:=strinoTmp+':'+ strtdh2+':'+ strtdbh +':'+ strfile +#13#10;
// /.<2E><><EFBFBD>ݴ<EFBFBD>ӡ
if(itmp<1 ) then begin
//
Continue;
end;
try
// <20>ı<EFBFBD>״̬<D7B4><CCAC><EFBFBD>¿<EFBFBD><C2BF><EFBFBD>
frm_main.db.BeginTrans;
xhs:='-1234';
//2.<2E>ı<EFBFBD>״̬
str:='update t_op_seae_paper_print_list set '
+' <20><>ӡ״̬=''<27>Ѵ<EFBFBD>ӡ'',<2C><>ӡ<EFBFBD><D3A1>='''+employee
+ ''',<2C><>ӡ<EFBFBD><D3A1><EFBFBD><EFBFBD>='''+ FormatDateTime('yyyy-mm-dd hh:mm:ss',GetDbDatetime)
+''' where <20><><EFBFBD><EFBFBD> = ' +strdyxh+' ';
aQueryUpdate.Close;
aQueryUpdate.SQL.Clear;
aQueryUpdate.SQL.Add(str);
aQueryUpdate.ExecSQL;
//3b<33>޸<EFBFBD><DEB8><EFBFBD><EFBFBD><EFBFBD>
aQuery.Close;
aQuery.SQL.Clear;
aQuery.SQL.Add('UPDATE [t_op_seae_paper_shipinc] '
+ ' SET [<5B>ᵥֽʣ<D6BD><CAA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>] = <20>ᵥֽʣ<D6BD><CAA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>- '+inttostr(itmp )
+ ' WHERE [<5B><><EFBFBD><EFBFBD>˾<EFBFBD><CBBE><EFBFBD><EFBFBD>] = ''' + cgsh1 +'''');
aQuery.ExecSQL;
frm_main.db.CommitTrans;
except on ex:Exception do
begin
m_infomation:='<27><>ӡ<EFBFBD><EFBFBD><E1B5A5><EFBFBD><EFBFBD><EFBFBD>쳣:'+ex.Message +'!';
Application.MessageBox(PChar(m_infomation),'<27><>Ϣ<EFBFBD><CFA2>ʾ',MB_ICONINFORMATION);
frm_main.db.RollbackTrans;
end;
end;//edn try
// ShowMessage(lcfile);
for im:=1 to qry1_paper_printlist.fieldbyname('<27><><EFBFBD><EFBFBD>').asinteger do begin
try
{
AcroPDF1.src:=lcfile;
AcroPDF1.LoadFile(lcfile);
AcroPDF1.Print;
}
if(hasreader) then
ShellExecute(Self.Handle,'open',PChar( rederpath) ,PChar(' -p '+lcfile ) , nil, SW_HIDE)
else
ShellExecute(Self.Handle,'print',PChar(lcfile),nil, nil, SW_HIDE);
Sleep(2000);
except
on ex: Exception do begin
m_infomation:='<27><>ӡ<EFBFBD><EFBFBD><E1B5A5><EFBFBD><EFBFBD><EFBFBD>쳣:'+ex.Message +'!';
Application.MessageBox(PChar(m_infomation),'<27><>Ϣ<EFBFBD><CFA2>ʾ',MB_ICONINFORMATION);
break;
end;
end;
cxprgrsbr1.Position:= Round(100*((i+1)/icount) ) ;
cxprgrsbr1.Refresh;
Sleep(3000);
end;
//EEEEEEEEEEEEEEEEEEE 2222
end;
qry_crm_client.close();
qry_crm_client.open;
end;
procedure Tfrm_op_seae_paper_print.N1Click(Sender: TObject);
begin
if(bsSkinPageControl1.ActivePage=bsSkinTabSheet1 ) then //bsSkinTabSheet1 0 dxdbgrd1_S
grid_save_xls(dxdbgrd1_S)
else if (bsSkinPageControl1.ActivePage=bskntbsht2_detail ) then //bskntbsht2_detail 1 dxdbgrd1_detail
grid_save_xls(dxdbgrd1_detail)
else if(bsSkinPageControl1.ActivePage=bskntbsht1 ) then // bskntbsht1 3 dxdbgrd3_notify
grid_save_xls(dxdbgrd3_notify) ;
end;
procedure Tfrm_op_seae_paper_print.Edit3_ztdhKeyPress(Sender: TObject; var Key: Char);
begin
if key=#13 then
begin
key:=#0;
//bsSkinButton8Click(Sender);
end;
end;
procedure Tfrm_op_seae_paper_print.dxdbgrdclmndxdbgrd1xdbgrdclmndxdbgrd1Column13CustomDraw(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 Trim(ANode.Strings[dxDBGrid2Column13.Index])<>'' then
AColor:=clred;
AFont.Color:=clblack;
}
end;
procedure Tfrm_op_seae_paper_print.dxDBGrid2Column14CustomDraw(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 Trim(ANode.Strings[dxDBGrid2Column14.Index])<>'' then
AColor:=clred;
AFont.Color:=clblack;
}
end;
procedure Tfrm_op_seae_paper_print.MenuItem1Click(Sender: TObject);
begin
if(bsSkinPageControl1.ActivePage=bsSkinTabSheet1 ) then //bsSkinTabSheet1 0 dxdbgrd1_S
grid_save_xls(dxdbgrd1_S)
else if (bsSkinPageControl1.ActivePage=bskntbsht2_detail ) then //bskntbsht2_detail 1 dxdbgrd1_detail
grid_save_xls(dxdbgrd1_detail)
else if(bsSkinPageControl1.ActivePage=bskntbsht1 ) then // bskntbsht1 3 dxdbgrd3_notify
grid_save_xls(dxdbgrd3_notify) ;
end;
procedure Tfrm_op_seae_paper_print.btn6_exitClick(Sender: TObject);
begin
Close;
end;
procedure Tfrm_op_seae_paper_print.btn11Click(Sender: TObject);
begin
bsSkinPageControl1.Pages[0].Visible:=true;
bsSkinPageControl1.Pages[1].Visible:=true;
bsSkinPageControl1.ActivePageIndex:=0;
end;
procedure Tfrm_op_seae_paper_print.FormResize(Sender: TObject);
begin
//
bsSkinTabSheet1.Width:=self.ClientWidth;
end;
procedure Tfrm_op_seae_paper_print.bsSkinButton14Click(Sender: TObject);
begin
Edit1_tdzbh.Text:='';
Edit6_searchtdh.Text:='';
wwDBDateTimePicker5.text:='';
wwDBDateTimePicker6.text:='';
cbb1_printstate.ItemIndex:=2;
end;
procedure Tfrm_op_seae_paper_print.Edit1_paperCountKeyPress(Sender: TObject;
var Key: Char);
begin
// <20>س<EFBFBD><D8B3>Զ<EFBFBD><D4B6><EFBFBD>ѯ
if key=#13 then
begin
btn4_searchNewClick(btn4_searchNew);
end;
end;
procedure Tfrm_op_seae_paper_print.btn_seach2Click(Sender: TObject);
var
str,strChgs,strtmp,strorder:string;
begin
str:='';
strChgs:= cbb2_shipinc_paper.DisplayValues[1] ;
if(strChgs='') then
begin
Application.MessageBox('<27><>ѡ<EFBFBD>񴬹<EFBFBD>˾','<27><>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>',MB_ICONINFORMATION);
exit;
end;
str:=' AND d.<2E><><EFBFBD><EFBFBD>˾<EFBFBD><CBBE><EFBFBD><EFBFBD>= ''' +strChgs +''' ';
strtmp:= StringReplace(trim(Edit1_tdzbh.text),'''','',[rfReplaceAll]);
if Edit1_tdzbh.text<>'' then
str:= str + ' AND d.<2E>ᵥֽ<E1B5A5><D6BD> like ''%' +strtmp +'%''';
strtmp:= StringReplace(trim(Edit6_searchtdh.text),'''','',[rfReplaceAll]);
if strtmp<>'' then
str:= str + ' AND d.<2E><EFBFBD><E1B5A5> like ''%' +strtmp +'%''';
//if( cbb1_printstate.ItemIndex >1) then
begin
if(wwDBDateTimePicker5.Text<>'') then
str:= str + ' AND d.<2E><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>>=''' + Trim(wwDBDateTimePicker5.Text) + ''' ';
//
if(wwDBDateTimePicker6.Text<>'') then
str:= str + ' AND d.<2E><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><=''' + Trim(wwDBDateTimePicker6.Text) + ' 23:59:59'' ';
end;
if cbb1_printstate.ItemIndex>0 then //0 Ϊ<<3C><>>
str:=str + ' AND isnull(d.[ʹ<><CAB9>״̬],''δ<><CEB4>ӡ'')='''+cbb1_printstate.Text+''' ' ;
//
strorder :=' order by <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<2C>ᵥֽ<E1B5A5><D6BD>';
if(qry2_crm_client_paper.FieldByName('ֽ<><D6BD>ʹ<EFBFBD><CAB9><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>').AsBoolean) then
strorder:= strorder + ' desc';
str:=str+strorder;
str:='SELECT d.[<5B><><EFBFBD><EFBFBD>],d.[<5B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>],d.[<5B><><EFBFBD><EFBFBD>˾<EFBFBD><CBBE><EFBFBD><EFBFBD>],d.[<5B>ᵥֽ<E1B5A5><D6BD>],d.[<5B><EFBFBD><E1B5A5><EFBFBD><EFBFBD>],'
+'d.[<5B><EFBFBD><E1B5A5>],d.[ҳ<><D2B3>],d.[<5B><>ҳ<EFBFBD><D2B3>],isnull(d.[ʹ<><CAB9>״̬],''δ<><CEB4>ӡ'') as [ʹ<><CAB9>״̬]'
+',d.[<5B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>],d.[<5B><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>],d.[<5B><>ע],d.[<5B>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>],d.[<5B><>ӡ̨<D3A1><CCA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>] '
+',m.¼<><C2BC><EFBFBD><EFBFBD> as <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,m.¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD> as <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> FROM '
+' [t_op_seae_paper_detail] d,t_op_seae_paper_in m where d.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>=m.<2E><><EFBFBD><EFBFBD> '
+ str;
with qry_paper_detail do begin
Close;
SQL.Clear;
SQL.Add(str);
Open;
end;
end;
procedure Tfrm_op_seae_paper_print.seachPrintList();
var
str:string;
begin
//
str:='';
if(Edit1_tdh.Text<>'') then
str:= str + ' AND plst.<2E><><EFBFBD><EFBFBD><E1B5A5> like ''%'
+ StringReplace( Trim(Edit1_tdh.Text),'''','''''',[rfReplaceAll]) + '%'' ';
if(cbb1_cgsh.DisplayValues[1]<>'') then
str:= str + ' AND plst.<2E><><EFBFBD><EFBFBD>˾ =''' + Trim(cbb1_cgsh.DisplayValues[1]) + ''' ';
if(cbb3_qdfsh.DisplayValues[1]<>'') then
str:= str + ' AND plst.ǩ<><C7A9><EFBFBD><EFBFBD>ʽ =''' + Trim(cbb3_qdfsh.DisplayValues[1]) + ''' ';
if(cbb4_dyzht.Text<>'<<3C><>>') then
str:= str + ' AND plst.<2E><>ӡ״̬ =''' + Trim(cbb4_dyzht.Text) + ''' ';
if(cbb4_dyzht.ItemIndex<> 1) then
begin
if(wdbdtmpckr1_kc.Text<>'') then
str:= str + ' AND plst.<2E><>ӡ<EFBFBD><D3A1><EFBFBD><EFBFBD>>=''' + Trim(wdbdtmpckr1_kc.Text) + ''' ';
//
if(wdbdtmpckr2_kc.Text<>'') then
str:= str + ' AND plst.<2E><>ӡ<EFBFBD><D3A1><EFBFBD><EFBFBD><=''' + Trim(wdbdtmpckr2_kc.Text) + ' 23:59:59'' ';
end;
if(cxchckbx1_shfhq.State=cbsChecked) then
str:= str + ' AND isnull(plst.[<5B>Ƿ<EFBFBD><C7B7><EFBFBD>ǩ],''false'')=1 '
else if(cxchckbx1_shfhq.State=cbsUnchecked) then
str:= str + ' AND isnull(plst.[<5B>Ƿ<EFBFBD><C7B7><EFBFBD>ǩ],''false'')=0 ' ;
// <20>ᵥֽǰ׺<C7B0><D7BA> 2017-09-26
str:=' SELECT plst.*,dbo.[fn_GetPaperPreNo](plst.<2E><><EFBFBD><EFBFBD>,plst.<2E><>ӡ״̬) as <20>ᵥֽǰ׺<C7B0><D7BA> , cast(plst.<2E><EFBFBD><E1B5A5><EFBFBD><EFBFBD> as varchar)+''<27><>''+ CAST( plst.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E1B5A5><EFBFBD><EFBFBD> as varchar) +''<27><>'' as ǩ<><C7A9>Ҫ<EFBFBD><D2AA>,sea.ί<>е<EFBFBD>λ ,sea.<2E><><EFBFBD><EFBFBD>Ա,sea.<2E><><EFBFBD><EFBFBD>,sea.<2E><><EFBFBD><EFBFBD> '
+ ' from ( SELECT p.<2E><><EFBFBD><EFBFBD>,p.<2E><><EFBFBD><EFBFBD>,p.<2E><><EFBFBD><EFBFBD><E1B5A5>,p.<2E><><EFBFBD><EFBFBD>˾,p.ǩ<><C7A9><EFBFBD><EFBFBD>ʽ,'
+' case when <20><><EFBFBD><EFBFBD>˾ in(''MAERSK'',''<27>ձ<EFBFBD><D5B1>ʴ<EFBFBD>'',''MCC'',''SAFMARINE'',''HAPAG'') then 1 else p.<2E><EFBFBD><E1B5A5><EFBFBD><EFBFBD> end as <20><><EFBFBD><EFBFBD>,p.<2E><EFBFBD><E1B5A5><EFBFBD><EFBFBD>'
+' ,p.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E1B5A5><EFBFBD><EFBFBD>,p.<2E>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>,p.<2E><><EFBFBD><EFBFBD>,p.<2E><><EFBFBD><EFBFBD>,p.<2E>ᵥҳ<E1B5A5><D2B3>'
+ ' , p.<2E>ᵥҳ<E1B5A5><D2B3> * case when <20><><EFBFBD><EFBFBD>˾ in( ''MAERSK'',''<27>ձ<EFBFBD><D5B1>ʴ<EFBFBD>'',''MCC'',''SAFMARINE'',''HAPAG'')then 1 else p.<2E><EFBFBD><E1B5A5><EFBFBD><EFBFBD> end as <20><>Ҫ<EFBFBD>ᵥֽ<E1B5A5><D6BD><EFBFBD><EFBFBD>'
+' ,p.<2E>Ƿ<EFBFBD><C7B7>ѷ<EFBFBD><D1B7><EFBFBD>,p.<2E><>ӡ״̬,p.<2E><>ӡ<EFBFBD><D3A1>,p.<2E><>ӡ<EFBFBD><D3A1><EFBFBD><EFBFBD>,p.<2E><>ע,p.<2E>Ƿ<EFBFBD><C7B7><EFBFBD>ǩ,p.<2E>Ƿ<EFBFBD><C7B7>ύ,p.<2E><EFBFBD><E1BDBB><EFBFBD><EFBFBD> '
+ ' ,p.<2E>ύ״̬,p.<2E><EFBFBD><E1BDBB>,p.<2E><EFBFBD><E1BDBB><EFBFBD><EFBFBD>,p.<2E>Ƿ<EFBFBD>ǩ<EFBFBD><C7A9>,p.ǩ<><C7A9><EFBFBD><EFBFBD>,p.ǩ<><C7A9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,p.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,p.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> '
+ ' ,s.ҵ<><D2B5>״̬ as ǩ<><C7A9>״̬,p.<2E>ᵥֽ<E1B5A5><D6BD>ʼ<EFBFBD><CABC>,p.<2E>ᵥֽ<E1B5A5><D6BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> FROM [t_op_seae_paper_print_list] p left join '
+ ' (select <20><><EFBFBD><EFBFBD><><D2B5>״̬,¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD> as ǩ<><C7A9><EFBFBD><EFBFBD><EFBFBD><EFBFBD> from t_op_state where ҵ<><D2B5>״̬=''<27>ᵥǩ<E1B5A5><C7A9>'') s '
+' on p.<2E><><EFBFBD><EFBFBD>=s.<2E><><EFBFBD><EFBFBD> ) plst,t_op_seae sea '
+ ' where plst.<2E><><EFBFBD><EFBFBD>=sea.<2E><><EFBFBD><EFBFBD> and plst.<2E>ύ״̬ in(''δ<>ύ'',''<27>Ѳ<EFBFBD><D1B2><EFBFBD>'')'
+ str +' order by <20><><EFBFBD><EFBFBD> ';
with qry1_paper_printlist do begin
//
Close;
SQL.Clear;
SQL.Add(str) ;
Open;
end;
dxdbgrd1_S.Refresh;
end;
function Tfrm_op_seae_paper_print.genPaperno():Boolean;
var
ipages :integer;
info,str,strppath :string;
aQuery:TAdoQuery;
begin
aQuery:=CreateAdoQuery();
try
iwbpdfdtr1.IsOpenVerify:=False;
iwbpdfdtr1.VerifySigner:=False;
str:=' select <20><><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD><E1B5A5>,<2C><><EFBFBD><EFBFBD>˾,<2C><><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD>,<2C>ᵥҳ<E1B5A5><D2B3>,<2C><EFBFBD><E1B5A5><EFBFBD><EFBFBD>,'
+' <20><>Ҫ<EFBFBD>ᵥֽ<E1B5A5><D6BD><EFBFBD><EFBFBD>,<2C>Ƿ<EFBFBD><C7B7>ѷ<EFBFBD><D1B7><EFBFBD> from t_op_seae_paper_print_list plst where plst.<2E>Ƿ<EFBFBD><C7B7>ѷ<EFBFBD><D1B7><EFBFBD>=0';
with aQuery do begin
//
Close;
SQL.Clear;
SQL.Add(str) ;
Open;
first;
if(not Eof) then
begin
while not Eof do
begin
strppath:=fieldbyname('<27><><EFBFBD><EFBFBD>').AsString;
ipages:= GetPDFPages(strppath);
if(ipages>-1) then
begin
Edit;
FieldByName('<27>ᵥҳ<E1B5A5><D2B3>').asinteger:=ipages;
if ipages<=0 then
ipages:=0;
if(fieldbyname('<27><><EFBFBD><EFBFBD>˾').AsString='MAERSK') or (fieldbyname('<27><><EFBFBD><EFBFBD>˾').AsString='<27>ձ<EFBFBD><D5B1>ʴ<EFBFBD>')
or (fieldbyname('<27><><EFBFBD><EFBFBD>˾').AsString='MCC') or (fieldbyname('<27><><EFBFBD><EFBFBD>˾').AsString='SAFMARINE' )
//2018-7-30<33><30><EFBFBD><EFBFBD>HAPAG<41><47>˾
or (fieldbyname('<27><><EFBFBD><EFBFBD>˾').AsString='HAPAG')
then
FieldByName('<27><>Ҫ<EFBFBD>ᵥֽ<E1B5A5><D6BD><EFBFBD><EFBFBD>').asinteger:=ipages
else
begin
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>HAPAG<41><47><EFBFBD><EFBFBD>˾<EFBFBD><CBBE>ֻ<EFBFBD><D6BB>ӡpdf<64>ж<EFBFBD><D0B6><EFBFBD>ҳ<EFBFBD><D2B3>ӡ<EFBFBD><D3A1><EFBFBD><EFBFBD>ҳ<EFBFBD><D2B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><><D2B3> 2018-7-31
if(fieldbyname('<27><><EFBFBD><EFBFBD>˾').AsString='MAERSK') or (fieldbyname('<27><><EFBFBD><EFBFBD>˾').AsString='<27>ձ<EFBFBD><D5B1>ʴ<EFBFBD>')
or (fieldbyname('<27><><EFBFBD><EFBFBD>˾').AsString='MCC') or (fieldbyname('<27><><EFBFBD><EFBFBD>˾').AsString='SAFMARINE' ) then
FieldByName('<27><>Ҫ<EFBFBD>ᵥֽ<E1B5A5><D6BD><EFBFBD><EFBFBD>').asinteger:=ipages*FieldByName('<27><EFBFBD><E1B5A5><EFBFBD><EFBFBD>').asinteger;
if (fieldbyname('<27><><EFBFBD><EFBFBD>˾').AsString='HAPAG') then
FieldByName('<27><>Ҫ<EFBFBD>ᵥֽ<E1B5A5><D6BD><EFBFBD><EFBFBD>').asinteger:=ipages;
end;
FieldByName('<27>Ƿ<EFBFBD><C7B7>ѷ<EFBFBD><D1B7><EFBFBD>').AsBoolean:=true;
end
else
showmessage(fieldbyname('<27><><EFBFBD><EFBFBD><E1B5A5>').AsString +'<27><EFBFBD><E1B5A5>ȡҳ<C8A1><D2B3>ʧ<EFBFBD><CAA7>!');
Next;
end;
if State in [dsedit,dsinsert] then
Post;
end;
end;
finally
///frm_u_op_seae_paper_getpages.Close;
//FreeAndNil(frm_u_op_seae_paper_getpages);
iwbpdfdtr1.IsOpenVerify:=False;
freeandnil(aQuery);
end;
end;
procedure Tfrm_op_seae_paper_print.ToOpenFile(strpath:string);
var
lcfile:string;
begin
lcfile:= GetWinTempPath()+ ExtractFileName(strpath);
if(FileExists(lcfile)) then
DeleteFile(lcfile);
CopyFile(pChar(strpath),pChar(lcfile),false);
iwbpdfdtr1.LoadFromFile(lcfile);
end;
function Tfrm_op_seae_paper_print.GetPDFPages(strpath:string):Integer;
begin
Result:=- 1 ;
try
if(FileExists(strpath) ) then
begin
ToOpenFile(strpath);
Result:= iwbpdfdtr1.PageCount;
iwbpdfdtr1.CloseRead;
//pdfctvx1.FPDF_CloseFile ();
if(Result<=0) then
showmessage(strpath+'<27><>ȡҳ<C8A1><D2B3>ʧ<EFBFBD><CAA7>!');
end
else
showmessage(strpath+'<27><><EFBFBD><EFBFBD><EFBFBD>ڻ<EFBFBD><DABB>߲<EFBFBD><DFB2>ɷ<EFBFBD><C9B7><EFBFBD>!');
except
end;
end;
procedure Tfrm_op_seae_paper_print.btn2_fxpageClick(Sender: TObject);
begin
//
try
bindPaperIn();
genPaperno();
seachPrintList();
ShowMessage('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!');
except
on ex:exception do
begin
Application.MessageBox(PChar('<27><><EFBFBD><EFBFBD>PDFҳ<46><D2B3>ʧ<EFBFBD><CAA7>:'+EX.Message),'',MB_ICONWARNING);
end;
end;
end;
procedure Tfrm_op_seae_paper_print.btn3_cancelPrintClick(Sender: TObject);
var
str,cgsh1,cgsh2,strtmp:string;
ipages,itmp,j:Integer;
m_infomation,printState:string;
aQuery:TADOQuery;
//blbh:Boolean;
begin
//
m_infomation:='';
ipages:=0;
itmp:=0;
if( dxdbgrd1_S.SelectedCount>1) then
begin
Application.MessageBox(PChar('<27><><EFBFBD>ܶ<EFBFBD>ѡ,<2C><>ѡ<EFBFBD><D1A1>һ<EFBFBD><D2BB><EFBFBD>Ѵ<EFBFBD>ӡ<EFBFBD><D3A1><EFBFBD>ᵥ'),'<27><>Ϣ<EFBFBD><CFA2>ʾ',MB_ICONWARNING);
exit;
end;
printState:=qry1_paper_printlist.FieldByName('<27><>ӡ״̬').AsString;
if printState<>'<27>Ѵ<EFBFBD>ӡ' then
begin
showmessage('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ѵ<EFBFBD>ӡ<EFBFBD><EFBFBD><E1B5A5><EFBFBD><EFBFBD>ȡ<EFBFBD><C8A1>!');
Exit;
end;
if qry1_paper_printlist.FieldByName('ǩ<><C7A9>״̬').AsString='<27>ᵥǩ<E1B5A5><C7A9>' then
begin
showmessage('<27><>ǩ<EFBFBD>ص<EFBFBD><D8B5><EFBFBD><E1B5A5><EFBFBD><EFBFBD>ȡ<EFBFBD><C8A1>!');
Exit;
end;
m_infomation:='<27><>Ҫȡ<D2AA><C8A1><EFBFBD><EFBFBD><E1B5A5>Ϊ' +qry1_paper_printlist.FieldByName('<27><><EFBFBD><EFBFBD><E1B5A5>').AsString
+ '<27><><EFBFBD><EFBFBD>Ĵ<EFBFBD>ӡ״̬<D7B4><CCAC>? ȡ<><C8A1><EFBFBD><EFBFBD>ӡ,<2C><>ӡֽ<D3A1><D6BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD><CAB9>,<2C><>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD>ᵥֽ'
+ inttostr(qry1_paper_printlist.FieldByName('<27><>Ҫ<EFBFBD>ᵥֽ<E1B5A5><D6BD><EFBFBD><EFBFBD>').AsInteger)
+'<27><>,<2C><>ȷʵҪȡ<D2AA><C8A1><EFBFBD><EFBFBD>ӡ<EFBFBD><D3A1>?';
if(Application.MessageBox(pchar(m_infomation),'<27><>Ϣ<EFBFBD><CFA2>ʾ', MB_ICONQUESTION+MB_YESNO) <> ID_YES) then
Exit;
// <20><>ӡ̨<D3A1><CCA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
try
//<2F><>ѡ
qry1_paper_printlist.GoTobookmark(pointer(dxdbgrd1_S.SelectedRows[0]));
itmp:= qry1_paper_printlist.FieldByName('<27><><EFBFBD><EFBFBD>').AsInteger;
aQuery:=CreateAdoQuery();
frm_main.db.BeginTrans;
with aQuery do begin
close;
sql.clear;
SQL.Add('UPDATE [t_op_seae_paper_shipinc] '
+ 'SET [<5B>ᵥֽʣ<D6BD><CAA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>]= [<5B>ᵥֽʣ<D6BD><CAA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>] + v.<2E><>Ҫ<EFBFBD>ᵥֽ<E1B5A5><D6BD><EFBFBD><EFBFBD> '
+ 'from ( SELECT [<5B><><EFBFBD><EFBFBD>˾] ,[<5B><>Ҫ<EFBFBD>ᵥֽ<E1B5A5><D6BD><EFBFBD><EFBFBD>],<2C><><EFBFBD><EFBFBD> FROM [t_op_seae_paper_print_list] '
+'where [<5B><>ӡ״̬]=''<27>Ѵ<EFBFBD>ӡ'' and <20><><EFBFBD><EFBFBD>='+ IntToStr(itmp)
+ ') v where [t_op_seae_paper_shipinc].<2E><><EFBFBD><EFBFBD>˾<EFBFBD><CBBE><EFBFBD><EFBFBD>=v.<2E><><EFBFBD><EFBFBD>˾;'
) ;
SQL.Add('UPDATE [t_op_seae_paper_detail] '
+ 'SET [<5B><EFBFBD><E1B5A5><EFBFBD><EFBFBD>] = null,[<5B><EFBFBD><E1B5A5>] = null,[ҳ<><D2B3>] =0,[<5B><>ҳ<EFBFBD><D2B3>] = 0,[ʹ<><CAB9>״̬] = null '
+' ,[<5B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>] = null ,[<5B><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>] = null,[<5B><>ע] =null,[<5B><>ӡ̨<D3A1><CCA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>] = null '
+' where [<5B><>ӡ̨<D3A1><CCA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>]='+ IntToStr(itmp) + ' ; '
) ;
SQL.Add('UPDATE [t_op_seae_paper_print_list] '
+ ' SET [<5B><>ӡ״̬] = ''ȡ<><C8A1><EFBFBD><EFBFBD>ӡ'' ,[<5B><>ע] = '''
+employee +':'+FormatDateTime('yyyy-mm-dd hh:mm:ss',GetDbDatetime)
+''' WHERE [<5B><><EFBFBD><EFBFBD>]=' + IntToStr(itmp)
);
ExecSQL();
end;
frm_main.db.CommitTrans;
bindPaperIn();
seachPrintList();
except
on ex:Exception do begin
frm_main.db.RollbackTrans;
errorlog(ex.Message) ;
ShowMessage(ex.Message);
end;
end;
end;
procedure Tfrm_op_seae_paper_print.btn4_rescindPrintClick(Sender: TObject);
var
str,cgsh1 :string;
ipages,itmp:Integer;
m_infomation ,printState :string;
aQuery:TADOQuery;
reasons:string;
blshfzftz:string;// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ч̨<D0A7><CCA8>
begin
//
m_infomation:='';
ipages:=0;
itmp:=0;
if( dxdbgrd1_S.SelectedCount>1) then
begin
Application.MessageBox(PChar('<27><><EFBFBD>ܶ<EFBFBD>ѡ,<2C><>ѡ<EFBFBD><D1A1>һ<EFBFBD><D2BB><EFBFBD>Ѵ<EFBFBD>ӡ<EFBFBD><D3A1><EFBFBD>ᵥ'),'<27><>Ϣ<EFBFBD><CFA2>ʾ',MB_ICONWARNING);
exit;
end;
printState:=qry1_paper_printlist.FieldByName('<27><>ӡ״̬').AsString;
if printState<>'<27>Ѵ<EFBFBD>ӡ' then
begin
showmessage('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ѵ<EFBFBD>ӡ<EFBFBD><EFBFBD><E1B5A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!');
Exit;
end;
m_infomation:='<27><>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><E1B5A5>Ϊ' +qry1_paper_printlist.FieldByName('<27><><EFBFBD><EFBFBD><E1B5A5>').AsString
+ '<27><><EFBFBD><EFBFBD>ı<EFBFBD><C4B1><EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD>״̬<D7B4><CCAC>? <20><><EFBFBD>ϴ<EFBFBD>ӡʱ<D3A1><CAB1>ӡֽ<D3A1><D6BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><><D2AA><EFBFBD><EFBFBD>' +#13#10
+ inttostr(qry1_paper_printlist.FieldByName('<27><>Ҫ<EFBFBD>ᵥֽ<E1B5A5><D6BD><EFBFBD><EFBFBD>').AsInteger)
+'<27><>,<2C><>ȷʵҪ<CAB5><D2AA><EFBFBD>ϴ<EFBFBD>ӡ<EFBFBD><D3A1>?';
if(Application.MessageBox(pchar(m_infomation),'<27><>Ϣ<EFBFBD><CFA2>ʾ', MB_ICONQUESTION+MB_YESNO) <> ID_YES) then
Exit;
reasons:=trim(InputBox('<27><><EFBFBD>ϴ<EFBFBD>ӡԭ<D3A1><D4AD>', 'ԭ<><D4AD>', ''));
if reasons=''then
begin
showmessage('ԭ<><D4AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD><D5A3><EFBFBD>');
reasons:=trim(InputBox('<27><><EFBFBD>ϴ<EFBFBD>ӡԭ<D3A1><D4AD>', 'ԭ<><D4AD>', ''));
end;
if reasons='' then
exit;
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ч̨<D0A7><CCA8>:<3A><><EFBFBD>Ϻ<EFBFBD><CFBA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>µĴ<C2B5>ӡ<EFBFBD><D3A1><EFBFBD><EFBFBD>
m_infomation:='<27>Ƿ<EFBFBD>ͬʱ<CDAC><CAB1><EFBFBD>ϴ<EFBFBD>Ʊ<EFBFBD><C6B1>ӡ̨<D3A1>ˣ<EFBFBD>';
blshfzftz:='0';
if(Application.MessageBox(pchar(m_infomation),'<27><>Ϣ<EFBFBD><CFA2>ʾ', MB_ICONQUESTION+MB_YESNO) <> ID_NO) then
blshfzftz:='1';
try
//<2F><>ѡ
qry1_paper_printlist.GoTobookmark(pointer(dxdbgrd1_S.SelectedRows[0]));
itmp:= qry1_paper_printlist.FieldByName('<27><><EFBFBD><EFBFBD>').AsInteger;
aQuery:=CreateAdoQuery();
frm_main.db.BeginTrans;
with aQuery do begin
close;
sql.clear;
SQL.Add('UPDATE [t_op_seae_paper_detail] '
+ 'SET ʹ<><CAB9>״̬ = ''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' '
+' ,[<5B><>ע] =''<27><>ӡ<EFBFBD><D3A1><EFBFBD><EFBFBD>:'
+ employee +':'+FormatDateTime('yyyy-mm-dd hh:mm:ss',GetDbDatetime)
+''',[<5B><>ӡ̨<D3A1><CCA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>] = null '
+' where [<5B><>ӡ̨<D3A1><CCA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>]='+ IntToStr(itmp) + ' ; '
);
SQL.Add('UPDATE [t_op_seae_paper_print_list] '
+ ' SET [<5B><>ӡ״̬] = ''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' ,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ч̨<D0A7><CCA8>='+ blshfzftz + ',[<5B><>ע] = '''
+ stringreplace(reasons,'''','''''',[rfReplaceAll])
+employee +':'+FormatDateTime('yyyy-mm-dd hh:mm:ss',GetDbDatetime)
+''' WHERE [<5B><><EFBFBD><EFBFBD>]=' + IntToStr(itmp)
);
ExecSQL();
end;
frm_main.db.CommitTrans;
bindPaperIn();
seachPrintList();
except
frm_main.db.RollbackTrans;
end;
//
end;
procedure Tfrm_op_seae_paper_print.dxdbgrd1_SColumnSorting(Sender: TObject;
Column: TdxDBTreeListColumn; var Allow: Boolean);
begin
Column_sort(Column,qry1_paper_printlist,'<27><><EFBFBD><EFBFBD>');
end;
procedure Tfrm_op_seae_paper_print.btn5_submitClick(Sender: TObject);
var
str,xhs:string;
bid,i:Integer;
aQuery:TADOQuery;
begin
if(not Checksubmit) then
exit;
// <20><>ȡ<EFBFBD><EFBFBD><E1BDBB><EFBFBD><EFBFBD>ID
bid:=get_sign_batin_id();
xhs:='-234';
aQuery:=CreateAdoQuery;
try
frm_main.db.BeginTrans;
for i:=0 to dxdbgrd1_S.SelectedCount-1 do
begin
qry1_paper_printlist.GoTobookmark(pointer(dxdbgrd1_S.SelectedRows[i]));
xhs:=xhs+','+ qry1_paper_printlist.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString;
end;
str:='update t_op_seae_paper_print_list set <20>Ƿ<EFBFBD><C7B7>ύ=1 '
+', <20><EFBFBD><E1BDBB><EFBFBD><EFBFBD>=' +inttostr(bid)+',<2C>ύ״̬=''<27><><EFBFBD>ύ'',<2C><EFBFBD><E1BDBB>='''+employee
+ ''',<2C><EFBFBD><E1BDBB><EFBFBD><EFBFBD>= GETDATE() where <20><><EFBFBD><EFBFBD> in(' +xhs+');';
frm_main.db.Execute(str);
//֪ͨ<CDA8><D6AA><EFBFBD><EFBFBD>ǩ<EFBFBD><C7A9>
str:='INSERT INTO [dbo].[t_op_state]([<5B><><EFBFBD><EFBFBD>],[ҵ<><D2B5>״̬],[¼<><C2BC><EFBFBD><EFBFBD>] ,[¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>] ) '
+' select <20><><EFBFBD><EFBFBD> ,''֪ͨǩ<D6AA><C7A9>'' as ҵ<><D2B5>״̬,'''+ employee +''' as ¼<><C2BC><EFBFBD><EFBFBD> ,GETDATE() ¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD> from '
+' (select <20><><EFBFBD><EFBFBD> from t_op_seae_paper_print_list d where <20><><EFBFBD><EFBFBD> in (' +xhs+')'
+' and not exists (select <20><><EFBFBD><EFBFBD> from [t_op_state] where ҵ<><D2B5>״̬=''֪ͨǩ<D6AA><C7A9>'' and <20><><EFBFBD><EFBFBD>= d.<2E><><EFBFBD><EFBFBD>)) v;';
frm_main.db.Execute(str);
frm_main.db.CommitTrans;
print_submit(IntToStr(bid));
seachPrintList();
btn1_notify_searchClick(btn1_notify_search);
except
on ex: Exception do
begin
qry1_paper_printlist.Cancel;
frm_main.db.RollbackTrans;
Application.messagebox(pchar('<27><EFBFBD><E1BDBB><EFBFBD><EFBFBD><EFBFBD>쳣:'+ex.Message),'<27><>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>',MB_ICONWARNING );
end;
end;
end;
function Tfrm_op_seae_paper_print.print_submit(bid:string):Boolean;
var
str,strinfo:string;
i,icount:Integer;
aQuery:TADOQuery;
begin
result:=True;
// <20><>ȡ<EFBFBD><EFBFBD><E1BDBB><EFBFBD><EFBFBD>ID
icount:=0;
//
str:='SELECT plst.*,dbo.[fn_GetPaperPreNo](plst.<2E><><EFBFBD><EFBFBD>,plst.<2E><>ӡ״̬) as <20>ᵥֽǰ׺<C7B0><D7BA>,sea.ί<>е<EFBFBD>λ, sea.<2E><><EFBFBD><EFBFBD>Ա, sea.<2E><><EFBFBD><EFBFBD>, sea.<2E><><EFBFBD><EFBFBD> FROM [t_op_seae_paper_print_list] plst , t_op_seae sea '
+' where plst.<2E><><EFBFBD><EFBFBD>=sea.<2E><><EFBFBD><EFBFBD> and plst.<2E><EFBFBD><E1BDBB><EFBFBD><EFBFBD>=' + bid +' ;';
with qry1_print do begin
Close;
SQL.Clear;
SQL.Add(str);
open;
end;
sys_print('<27>ᵥǩ<E1B5A5><C7A9>֪ͨ',1,ds2_print,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil);
end;
function Tfrm_op_seae_paper_print.Checksubmit():Boolean; //<2F><EFBFBD>Ѵ<EFBFBD>ӡ δ<><20><>ǩ<EFBFBD><C7A9>
var
i,itmp :integer;
aQuery:TADOQuery;
blchk:Boolean;
strtmp,tdh,info:string;
begin
Result:=true;
for i:=0 to dxdbgrd1_S.SelectedCount-1 do
begin
qry1_paper_printlist.GoTobookmark(pointer(dxdbgrd1_S.SelectedRows[i]));
tdh:= qry1_paper_printlist.FieldByName('ǩ<><C7A9>״̬').AsString;
//<2F>Ƿ<EFBFBD><C7B7>Ѵ<EFBFBD>ӡ
if( qry1_paper_printlist.FieldByName('<27><>ӡ״̬').AsString<>'<27>Ѵ<EFBFBD>ӡ') then
begin
Application.MessageBox(PChar('<27><><EFBFBD><EFBFBD>δ<EFBFBD><CEB4>ӡ<EFBFBD><D3A1><EFBFBD>ᵥ' +tdh + '<27><><EFBFBD><EFBFBD><EFBFBD>ύ'),'',MB_ICOninformation);
result:=false;
exit;
end;
if(qry1_paper_printlist.FieldByName('ǩ<><C7A9>״̬').IsNull) then
begin
Application.MessageBox(PChar('<27><><EFBFBD><EFBFBD>δǩ<CEB4>ص<EFBFBD><D8B5>ᵥ' +tdh + '<27><><EFBFBD><EFBFBD><EFBFBD>ύ'),'',MB_ICOninformation);
result:=false;
exit;
end;
//<2F><><EFBFBD>ύ,<2C>ύ״̬Ϊ<CCAC><CEAA><EFBFBD><EFBFBD><EFBFBD>صĿ<D8B5><C4BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
if(qry1_paper_printlist.FieldByName('<27>Ƿ<EFBFBD><C7B7>ύ').AsBoolean) and
(qry1_paper_printlist.FieldByName('<27>ύ״̬').AsString<>'<27>Ѳ<EFBFBD><D1B2><EFBFBD>')
then
begin
Application.MessageBox(PChar('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E1BDBB><EFBFBD>ᵥ' +tdh + '<27><><EFBFBD><EFBFBD><EFBFBD>ύ'),'',MB_ICOninformation);
result:=false;
exit;
end;
//
end;
end;
procedure Tfrm_op_seae_paper_print.btn6_cancelSubmitClick(Sender: TObject);
var
str,bid,strinfo:string;
i,icount:Integer;
aQuery:TADOQuery;
begin
// <20><>ȡ<EFBFBD><EFBFBD><E1BDBB><EFBFBD><EFBFBD>ID
if(qry2_paper_printlist.Recordset.RecordCount<1) then
begin
Application.messagebox(pchar('<27><>ѡ<EFBFBD><D1A1>Ҫȡ<D2AA><C8A1><EFBFBD><EFBFBD><EFBFBD>ᵥ'),'<27><>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>',MB_ICONINFORMATION );
Exit;
end;
if( qry2_paper_printlist.FieldByName('<27>ύ״̬').AsString<>'<27><><EFBFBD>ύ') then
begin
Application.MessageBox(PChar('ֻ<><D6BB>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E1BDBB><EFBFBD>ᵥ!'),'',MB_ICOninformation);
exit;
end;
//
aQuery:=CreateAdoQuery;
icount:=0;
//
bid:= qry2_paper_printlist.fieldbyname('<27><EFBFBD><E1BDBB><EFBFBD><EFBFBD>').AsString;
str:='SELECT [<5B><><EFBFBD><EFBFBD>],[<5B><><EFBFBD><EFBFBD>],[<5B><><EFBFBD><EFBFBD><E1B5A5>] FROM [t_op_seae_paper_print_list] '
+' where <20><EFBFBD><E1BDBB><EFBFBD><EFBFBD>=' + bid +' ;';
with aQuery do begin
Close;
SQL.Clear;
SQL.Add(str);
open;
icount:=Recordset.RecordCount;
end;
strinfo:='<27>Ƿ<EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>ѡ<EFBFBD><EFBFBD><E1BDBB><EFBFBD><EFBFBD>Ϊ'+ bid+ '<27><>'+inttostr(icount)+'Ʊ<>ᵥ';
if(Application.MessageBox(pchar(strinfo),'<27><>Ϣ<EFBFBD><CFA2>ʾ', MB_ICONQUESTION+MB_YESNO) <> ID_YES) then
Exit;
try
frm_main.db.BeginTrans;
//
aQuery.close;
aQuery.sql.Clear;
str:='UPDATE [t_op_seae_paper_print_list] '
+ 'SET <20>Ƿ<EFBFBD><C7B7>ύ=0, <20><EFBFBD><E1BDBB>=null,<2C><EFBFBD><E1BDBB><EFBFBD><EFBFBD>=null,[<5B>ύ״̬]=''δ<>ύ'' WHERE [<5B><EFBFBD><E1BDBB><EFBFBD><EFBFBD>] = ' + bid ;
aQuery.SQL.Add(str);
aQuery.ExecSQL;
str:='delete from [t_op_state] where ҵ<><D2B5>״̬=''֪ͨǩ<D6AA><C7A9>'' and exists '
+' (select <20><><EFBFBD><EFBFBD> from t_op_seae_paper_print_list d where '
+' <20><EFBFBD><E1BDBB><EFBFBD><EFBFBD>=' + bid + ' and <20><><EFBFBD><EFBFBD>=[t_op_state].<2E><><EFBFBD><EFBFBD>)' ;
frm_main.db.Execute(str);
frm_main.db.CommitTrans;
btn1_notify_searchClick( btn1_notify_search);
seachPrintList();
except
on ex: Exception do
begin
frm_main.db.RollbackTrans;
Application.messagebox(pchar('<27><><EFBFBD>ط<EFBFBD><D8B7><EFBFBD><EFBFBD>쳣:'+ex.Message),'<27><>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>',MB_ICONWARNING );
end;
end;
//
end;
procedure Tfrm_op_seae_paper_print.btn1_notify_searchClick(
Sender: TObject);
begin
seachSubmitList();
end;
procedure Tfrm_op_seae_paper_print.seachSubmitList();
var
str:string;
begin
//
str:='';
if(edt1_tdh.Text<>'') then
str:= str + ' AND <20><><EFBFBD><EFBFBD><E1B5A5> like ''%' + Trim(edt1_tdh.Text) + '%'' ';
if(wdbdtmpckr1.Text<>'') then
str:= str + ' AND <20><EFBFBD><E1BDBB><EFBFBD><EFBFBD>>=''' + Trim(wdbdtmpckr1.Text) + ''' ';
//
if(wdbdtmpckr2.Text<>'') then
str:= str + ' AND <20><EFBFBD><E1BDBB><EFBFBD><EFBFBD><=''' + Trim(wdbdtmpckr2.Text) + ' 23:59:59'' ';
if(cbb2_submitstate.ItemIndex>0) then
str:= str + ' AND <20>ύ״̬ =''' + Trim(cbb2_submitstate.Text) + ''' ';
str:='select *, cast(<28><EFBFBD><E1B5A5><EFBFBD><EFBFBD> as varchar)+''<27><>''+ CAST( <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E1B5A5><EFBFBD><EFBFBD> as varchar) +''<27><>'' as ǩ<><C7A9>Ҫ<EFBFBD><D2AA> '
+ ' from ( SELECT p.<2E><><EFBFBD><EFBFBD>,p.<2E><><EFBFBD><EFBFBD>,p.<2E><><EFBFBD><EFBFBD><E1B5A5>,p.<2E><><EFBFBD><EFBFBD>˾,p.ǩ<><C7A9><EFBFBD><EFBFBD>ʽ,'
// case when <20><><EFBFBD><EFBFBD>˾=''MAERSK'' then 1 else p.<2E><EFBFBD><E1B5A5><EFBFBD><EFBFBD> end as
+' <20><><EFBFBD><EFBFBD>,p.<2E><EFBFBD><E1B5A5><EFBFBD><EFBFBD>'
+' ,p.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E1B5A5><EFBFBD><EFBFBD>,p.<2E>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>,p.<2E><><EFBFBD><EFBFBD>,p.<2E><><EFBFBD><EFBFBD>,p.<2E>ᵥҳ<E1B5A5><D2B3>'
+ ' , p.<2E>ᵥҳ<E1B5A5><D2B3> * case when <20><><EFBFBD><EFBFBD>˾=''MAERSK'' then 1 else p.<2E><EFBFBD><E1B5A5><EFBFBD><EFBFBD> end as <20><>Ҫ<EFBFBD>ᵥֽ<E1B5A5><D6BD><EFBFBD><EFBFBD>'
+' ,p.<2E>Ƿ<EFBFBD><C7B7>ѷ<EFBFBD><D1B7><EFBFBD>,p.<2E><>ӡ״̬,p.<2E><>ӡ<EFBFBD><D3A1>,p.<2E><>ӡ<EFBFBD><D3A1><EFBFBD><EFBFBD>,p.<2E><>ע,p.<2E>Ƿ<EFBFBD><C7B7><EFBFBD>ǩ,p.<2E>Ƿ<EFBFBD><C7B7>ύ,p.<2E><EFBFBD><E1BDBB><EFBFBD><EFBFBD> '
+ ' ,p.<2E>ύ״̬,p.<2E><EFBFBD><E1BDBB>,p.<2E><EFBFBD><E1BDBB><EFBFBD><EFBFBD>,p.<2E>Ƿ<EFBFBD>ǩ<EFBFBD><C7A9>,p.ǩ<><C7A9><EFBFBD><EFBFBD>,p.ǩ<><C7A9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,p.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,p.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> '
+ ' ,s.ҵ<><D2B5>״̬ as ǩ<><C7A9>״̬ FROM [t_op_seae_paper_print_list] p left join '
+ ' (select <20><><EFBFBD><EFBFBD><><D2B5>״̬,¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD> as ǩ<><C7A9><EFBFBD><EFBFBD><EFBFBD><EFBFBD> from t_op_state where ҵ<><D2B5>״̬=''<27>ᵥǩ<E1B5A5><C7A9>'') s '
+' on p.<2E><><EFBFBD><EFBFBD>=s.<2E><><EFBFBD><EFBFBD> ) plst '
+ ' where <20>ύ״̬ not in(''δ<>ύ'',''<27>Ѳ<EFBFBD><D1B2><EFBFBD>'')'
+ str +' order by <20><><EFBFBD><EFBFBD> ';
with qry2_paper_printlist do begin
//
Close;
SQL.Clear;
SQL.Add(str) ;
Open;
end;
end;
procedure Tfrm_op_seae_paper_print.btn6_notify_exitClick(Sender: TObject);
begin
Close();
end;
procedure Tfrm_op_seae_paper_print.btn2_notify_clearClick(Sender: TObject);
begin
//
wdbdtmpckr1.text:='';
wdbdtmpckr2.text:='';
edt1_tdh.text:='';
cbb2_submitstate.ItemIndex:=0;
end;
procedure Tfrm_op_seae_paper_print.btn3Click(Sender: TObject);
var
str,xhs:string;
bid,i:Integer;
aQuery:TADOQuery;
begin
xhs:='-234';
aQuery:=CreateAdoQuery;
if(dxdbgrd1_S.SelectedCount>0) then
for i:=0 to dxdbgrd1_S.SelectedCount-1 do
begin
qry1_paper_printlist.GoTobookmark(pointer(dxdbgrd1_S.SelectedRows[i]));
xhs:=xhs+','+ qry1_paper_printlist.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString;
end ;
str:=' SELECT plst.*,dbo.[fn_GetPaperPreNo](plst.<2E><><EFBFBD><EFBFBD>,plst.<2E><>ӡ״̬) as <20>ᵥֽǰ׺<C7B0><D7BA>,sea.ί<>е<EFBFBD>λ, sea.<2E><><EFBFBD><EFBFBD>Ա,sea.<2E><><EFBFBD><EFBFBD>,sea.<2E><><EFBFBD><EFBFBD> FROM [t_op_seae_paper_print_list] plst , t_op_seae sea '
+' where plst.<2E><><EFBFBD><EFBFBD>=sea.<2E><><EFBFBD><EFBFBD> and plst.<2E><><EFBFBD><EFBFBD> in (' + xhs +' );';
with qry1_print do begin
Close;
SQL.Clear;
SQL.Add(str);
open;
end;
sys_print('<27>ᵥǩ<E1B5A5><C7A9>֪ͨ',2,ds2_print,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil);
end;
/// <summary>
/// <20><><EFBFBD><EFBFBD>ҳ<EFBFBD><D2B3>
/// </summary>
procedure Tfrm_op_seae_paper_print.bsSkinButton4Click(Sender: TObject);
var
strNum,cgsh1,cgsh2,strxhs,str:string;
i,inum:integer;
aQuery:TADOQuery;
begin
if(dxdbgrd1_detail.SelectedCount<1) then
Exit;
strxhs:='-123';
for i:=0 to dxdbgrd1_detail.SelectedCount do begin
if i=0 then
begin
cgsh1 := qry_paper_detail.FieldByName('<27><><EFBFBD><EFBFBD>˾<EFBFBD><CBBE><EFBFBD><EFBFBD>').AsString;
cgsh2:=cgsh1;
end
else
begin
cgsh2 := qry_paper_detail.FieldByName('<27><><EFBFBD><EFBFBD>˾<EFBFBD><CBBE><EFBFBD><EFBFBD>').AsString;
end;
//
if cgsh1<>cgsh2 then
begin
showmessage('<27><><EFBFBD><EFBFBD>˾<EFBFBD><CBBE>Ψһ!');
Exit;
end;
strxhs:=strxhs+','+ qry_paper_detail.FieldByName('<27><><EFBFBD><EFBFBD>').AsString;
end;
//qry_paper_detail
strNum:=trim(InputBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ҳ<EFBFBD><D2B3>', '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ҳ<EFBFBD><D2B3>', ''));
if strNum='' then
begin
showmessage('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ҳ<EFBFBD><D2B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD><D5A3><EFBFBD>');
Exit;
end;
try
inum:= StrToInt(Trim(strnum));
if( inum <1) then
begin
showmessage('<27><><EFBFBD><EFBFBD><EFBFBD>ĵ<EFBFBD><C4B5><EFBFBD><EFBFBD><EFBFBD>ҳ<EFBFBD><D2B3><EFBFBD><EFBFBD>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>0<EFBFBD><30>');
exit;
end;
except
showmessage('<27><><EFBFBD><EFBFBD><EFBFBD>ĵ<EFBFBD><C4B5><EFBFBD><EFBFBD><EFBFBD>ҳ<EFBFBD><D2B3><EFBFBD><EFBFBD>ʽ<EFBFBD><CABD><EFBFBD>󣡣<EFBFBD>');
exit;
end;
//У<><D0A3>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD>ҳ<EFBFBD><D2B3><EFBFBD>Ƿ<EFBFBD><C7B7>DZ<EFBFBD>ռ<EFBFBD><D5BC>.....
str:=' select top ' + IntToStr(inum)+ ' <20><><EFBFBD><EFBFBD>,<2C><EFBFBD><E1B5A5> from t_op_seae_paper_detail '
+' where <20><><EFBFBD><EFBFBD>˾<EFBFBD><CBBE><EFBFBD><EFBFBD>='''+ cgsh1 + ''' and isnull(ʹ<><CAB9>״̬,'''')<>''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'''
+' and <20>ᵥֽ<E1B5A5><D6BD>> (select MAX(dt.<2E>ᵥֽ<E1B5A5><D6BD>) from t_op_seae_paper_detail dt '
+' where dt.<2E><><EFBFBD><EFBFBD> in (' + strxhs+ ') ) and isnull(ʹ<><CAB9>״̬,'''')=''<27>Ѵ<EFBFBD>ӡ'' ';
aQuery:=CreateAdoQuery();
with aQuery do
begin
Close;
sql.Clear;
sql.Add(str);
Open;
First;
end;
if(not aQuery.IsEmpty) then
begin
showmessage('Ҫ<><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӡ<EFBFBD><D3A1>¼<EFBFBD><C2BC><EFBFBD>ڵĴ<DAB5>ӡֽ<D3A1><D6BD>' + IntToStr(aQuery.Recordset.recordcount )
+ '<27><>,<2C>Ѿ<EFBFBD><D1BE><EFBFBD>ʹ<EFBFBD><CAB9>,<2C><><EFBFBD>ܵ<EFBFBD><DCB5><EFBFBD><EFBFBD><EFBFBD>');
exit;
end;
//У<><D0A3>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD>ҳ<EFBFBD><D2B3><EFBFBD>Ƿ<EFBFBD><C7B7>ǹ<EFBFBD><C7B9><EFBFBD>.....
str:=' select top ' + IntToStr(inum)+ ' <20><><EFBFBD><EFBFBD>,<2C><EFBFBD><E1B5A5> from t_op_seae_paper_detail '
+' where <20><><EFBFBD><EFBFBD>˾<EFBFBD><CBBE><EFBFBD><EFBFBD>='''+ cgsh1 + ''' and isnull(ʹ<><CAB9>״̬,'''')<>''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'''
+' and <20>ᵥֽ<E1B5A5><D6BD>> (select MAX(dt.<2E>ᵥֽ<E1B5A5><D6BD>) from t_op_seae_paper_detail dt '
+' where dt.<2E><><EFBFBD><EFBFBD> in (' + strxhs+ ') ) and isnull(ʹ<><CAB9>״̬,'''')=''<27>Ѵ<EFBFBD>ӡ'' ';
aQuery:=CreateAdoQuery();
with aQuery do
begin
Close;
sql.Clear;
sql.Add(str);
Open;
First;
end;
if(not aQuery.IsEmpty) then
begin
showmessage('Ҫ<><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӡ<EFBFBD><D3A1>¼<EFBFBD><C2BC><EFBFBD>ڵĴ<DAB5>ӡֽ<D3A1><D6BD>' + IntToStr(aQuery.Recordset.recordcount )
+ '<27><>,<2C>Ѿ<EFBFBD><D1BE><EFBFBD>ʹ<EFBFBD><CAB9>,<2C><><EFBFBD>ܵ<EFBFBD><DCB5><EFBFBD><EFBFBD><EFBFBD>');
exit;
end;
str:= ' select * from t_op_seae_paper_print_list where <20><><EFBFBD><EFBFBD> in ( '+strxhs+')';
end;
procedure Tfrm_op_seae_paper_print.btn1_RefreshTaskClick(Sender: TObject);
begin
//
end;
procedure Tfrm_op_seae_paper_print.seachtaskList();
var
str:string;
begin
//
qry3_notifyTask.Active:=false;
qry3_notifyTask.Active:=true;
end;
procedure Tfrm_op_seae_paper_print.btn3_2printDesignClick(Sender: TObject);
begin
sys_print('<27>ᵥǩ<E1B5A5><C7A9>֪ͨ',2,ds3_notifytask,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil);
end;
procedure Tfrm_op_seae_paper_print.btn3_1_tasksubmitClick(Sender: TObject);
var
str,strbhs:string;
i:Integer;
begin
if(dxdbgrd3_notiffyTask.SelectedCount<1) then
Exit;
// %s:¼<><C2BC><EFBFBD><EFBFBD> %s <20><><EFBFBD><EFBFBD>
str:=' INSERT INTO [t_op_seae_signin_notify] '
+'([<5B><EFBFBD><E1BDBB><EFBFBD><EFBFBD>],[<5B><><EFBFBD><EFBFBD>],[<5B><><EFBFBD><EFBFBD><E1B5A5>],[<5B><><EFBFBD><EFBFBD>˾],[ί<>е<EFBFBD>λ],[ǩ<><C7A9><EFBFBD><EFBFBD>ʽ],'
+'[<5B>Ƿ<EFBFBD><C7B7><EFBFBD>ǩ],[<5B><><EFBFBD><EFBFBD>Ա],[ǩ<><C7A9><EFBFBD><EFBFBD>],[ǩ<><C7A9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>],[<5B><>ӡ״̬],[<5B><EFBFBD><E1BDBB>],[<5B><EFBFBD><E1BDBB><EFBFBD><EFBFBD>]) ' +#13#10
+' select v0.<2E><><EFBFBD><EFBFBD>,v0.<2E><><EFBFBD><EFBFBD><E1B5A5>,v0.<2E><><EFBFBD><EFBFBD>˾,v0.ί<>е<EFBFBD>λ,v0.ǩ<><C7A9><EFBFBD><EFBFBD>ʽ,v0.<2E>Ƿ<EFBFBD><C7B7><EFBFBD>ǩ,'
+'v0.<2E><><EFBFBD><EFBFBD>Ա,v0.ǩ<><C7A9><EFBFBD><EFBFBD>,v0.ǩ<><C7A9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,p.<2E><>ӡ״̬,''%s'' as <20><EFBFBD><E1BDBB>,getdate() as <20><EFBFBD><E1BDBB><EFBFBD><EFBFBD> ' +#13#10
+' from ' +#13#10
+' (select sea.<2E><><EFBFBD><EFBFBD>,sea.<2E><><EFBFBD><EFBFBD><E1B5A5>,sea.<2E><><EFBFBD><EFBFBD>˾,sea.ί<>е<EFBFBD>λ,sea.ǩ<><C7A9><EFBFBD><EFBFBD>ʽ,'
+' sea.<2E>Ƿ<EFBFBD><C7B7><EFBFBD>ǩ,sea.<2E><><EFBFBD><EFBFBD>Ա, S.ǩ<><C7A9><EFBFBD><EFBFBD>,S.ǩ<><C7A9><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ' +#13#10
+' from t_op_seae sea join ( select distinct <20><><EFBFBD><EFBFBD><><D2B5>״̬,¼<><C2BC><EFBFBD><EFBFBD> as ǩ<><C7A9><EFBFBD><EFBFBD>'
+' ,¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD> as ǩ<><C7A9><EFBFBD><EFBFBD><EFBFBD><EFBFBD> from t_op_state where ҵ<><D2B5>״̬=''<27>ᵥǩ<E1B5A5><C7A9>'' ' +#13#10
+' and DATEDIFF(DAY, ¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,getdate())<=13 /*2<><32><EFBFBD><EFBFBD>*/ ' +#13#10
+' ) s ' +#13#10
+' on sea.<2E><><EFBFBD><EFBFBD>=s.<2E><><EFBFBD><EFBFBD> where (sea.ǩ<><C7A9><EFBFBD><EFBFBD>ʽ=''<27><><EFBFBD><EFBFBD>'' OR sea.ǩ<><C7A9><EFBFBD><EFBFBD>ʽ=''<27><><EFBFBD><EFBFBD><EFBFBD>ᵥ'') '
+' and sea.<2E><><EFBFBD><EFBFBD> in(%s) and not exists (select distinct <20><><EFBFBD><EFBFBD><><D2B5>״̬ ' +#13#10
+' from t_op_state s where s.<2E><><EFBFBD><EFBFBD>= sea.<2E><><EFBFBD><EFBFBD> and s.ҵ<><D2B5>״̬=''<27>ᵥǩ<E1B5A5><C7A9>'') ' +#13#10
+' )v0 left join (select pr.<2E><><EFBFBD><EFBFBD> ,pr.<2E><>ӡ״̬ from '
+' t_op_seae_paper_print_list pr where pr.<2E><>ӡ״̬=''<27>Ѵ<EFBFBD>ӡ'' )p '
+' on v0.<2E><><EFBFBD><EFBFBD>=p.<2E><><EFBFBD><EFBFBD> ;' ;
for i:=0 to dxdbgrd3_notiffyTask.SelectedCount do
begin
if(i=0) then
strbhs:=''''+ qry3_notifyTask.FieldByName('<27><><EFBFBD><EFBFBD>').AsString +''''
else
strbhs:=strbhs+','+ qry3_notifyTask.FieldByName('<27><><EFBFBD><EFBFBD>').AsString;
end;
str:=Format(str,[employee,strbhs]);
ShowMessage(str);
try
frm_main.db.Execute(str);
except
on ex:Exception do begin
errorlog(ex.Message);
ShowMessage(ex.Message);
end;
end;
end;
procedure Tfrm_op_seae_paper_print.cxchckbx1_shfhqClick(Sender: TObject);
begin
seachPrintList();
end;
procedure Tfrm_op_seae_paper_print.dxdbgrd1_SChangeNode(Sender: TObject;
OldNode, Node: TdxTreeListNode);
var
ipages:Integer;
begin
if(dxdbgrd1_S.SelectedCount<1) then
txtSelPages.Caption:='0';
if(dxdbgrd1_S.SelectedCount>1) then
exit;
ipages:=0;
ipages:= qry1_paper_printlist.FieldByName('<27><>Ҫ<EFBFBD>ᵥֽ<E1B5A5><D6BD><EFBFBD><EFBFBD>').AsInteger;
txtSelPages.Caption:='ѡ<><D1A1>ҳ<EFBFBD><D2B3>:'+IntToStr(ipages);
end;
procedure Tfrm_op_seae_paper_print.dxdbgrd1_SSelectedCountChange(
Sender: TObject);
var
i,itmp,ipages:Integer;
begin
if(dxdbgrd1_S.SelectedCount<1) then
txtSelPages.Caption:='0';
ipages:=0;
for i:=0 to dxdbgrd1_S.SelectedCount-1 do
begin
qry1_paper_printlist.GoTobookmark(pointer(dxdbgrd1_S.SelectedRows[i]));
itmp:= qry1_paper_printlist.FieldByName('<27><>Ҫ<EFBFBD>ᵥֽ<E1B5A5><D6BD><EFBFBD><EFBFBD>').AsInteger;
//1 <20><>¼<EFBFBD><C2BC>ϸ
ipages:=ipages+itmp;
end;
txtSelPages.Caption:='ѡ<><D1A1>ҳ<EFBFBD><D2B3>:'+IntToStr(ipages);
end;
end.