D7wmguihua/桂华管理系统/U_CKProductBCPInList_Other.pas
DESKTOP-E401PHE\Administrator b4b5840f18 1
2025-01-18 16:22:10 +08:00

1011 lines
29 KiB
ObjectPascal
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

unit U_CKProductBCPInList_Other;
interface
uses
Windows, Messages, strutils,SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData,
cxDataStorage, cxEdit, DB, cxDBData, cxGridCustomTableView,
cxGridTableView, cxGridBandedTableView, cxGridDBBandedTableView,
cxGridLevel, cxClasses, cxControls, cxGridCustomView, cxGridDBTableView,
cxGrid, StdCtrls, ComCtrls, ExtCtrls, ToolWin, cxGridCustomPopupMenu,
cxGridPopupMenu, ADODB, DBClient, cxDropDownEdit, cxCheckBox, RM_Common,
RM_Class, RM_e_Xls, RM_Dataset, RM_System, RM_GridReport, Menus,
RM_BarCode;
type
TfrmCKProductBCPInList_other = class(TForm)
ToolBar1: TToolBar;
TBRafresh: TToolButton;
TBFind: TToolButton;
TBExport: TToolButton;
TBPrint: TToolButton;
TBClose: TToolButton;
Panel1: TPanel;
ADOQueryCmd: TADOQuery;
ADOQueryMain: TADOQuery;
ADOQueryTemp: TADOQuery;
DataSource1: TDataSource;
cxGridPopupMenu1: TcxGridPopupMenu;
Label3: TLabel;
Label4: TLabel;
C_CodeName: TEdit;
C_Color: TEdit;
Label1: TLabel;
Label2: TLabel;
BegDate: TDateTimePicker;
EndDate: TDateTimePicker;
CDS_Main: TClientDataSet;
Label5: TLabel;
conNo: TEdit;
Label6: TLabel;
MJID: TEdit;
Label8: TLabel;
KZ: TEdit;
Label9: TLabel;
MF: TEdit;
Label7: TLabel;
CPType: TComboBox;
cxGrid2: TcxGrid;
Tv1: TcxGridDBTableView;
v1Column1: TcxGridDBColumn;
v2Column1: TcxGridDBColumn;
v1Column8: TcxGridDBColumn;
v1Column9: TcxGridDBColumn;
v1Column6: TcxGridDBColumn;
v1Column5: TcxGridDBColumn;
v1Column3: TcxGridDBColumn;
v1Column2: TcxGridDBColumn;
v2Column5: TcxGridDBColumn;
v2Column6: TcxGridDBColumn;
v1Column7: TcxGridDBColumn;
v1Column10: TcxGridDBColumn;
cxGrid2Level1: TcxGridLevel;
Label10: TLabel;
BCGangNo: TEdit;
RM1: TRMGridReport;
RMDBMain: TRMDBDataSet;
RMXLSExport1: TRMXLSExport;
RMDBHZ: TRMDBDataSet;
CDS_HZ: TClientDataSet;
TBRKCX: TToolButton;
v1Column4: TcxGridDBColumn;
PopupMenu1: TPopupMenu;
N1: TMenuItem;
N2: TMenuItem;
v1RollNum: TcxGridDBColumn;
TBADD: TToolButton;
v1C_Color: TcxGridDBColumn;
v1gangNO: TcxGridDBColumn;
v1kcKw: TcxGridDBColumn;
v1CRType: TcxGridDBColumn;
TBEdit: TToolButton;
ToolButton2: TToolButton;
CRTYPE: TComboBox;
Label12: TLabel;
v1ThCust: TcxGridDBColumn;
v1Note: TcxGridDBColumn;
Label11: TLabel;
factoryNoName: TEdit;
Label13: TLabel;
ThCust: TEdit;
CheckBox1: TCheckBox;
ADOPrint1: TADOQuery;
ADOPrint: TADOQuery;
RMDB_MD: TRMDBDataSet;
RMDB_Sub: TRMDBDataSet;
v1Column11: TcxGridDBColumn;
v1Column12: TcxGridDBColumn;
v1Column13: TcxGridDBColumn;
v1Column14: TcxGridDBColumn;
v1Column15: TcxGridDBColumn;
ToolButton3: TToolButton;
ToolButton4: TToolButton;
ToolButton5: TToolButton;
ToolButton1: TToolButton;
ToolButton6: TToolButton;
RMGridReport1: TRMGridReport;
ADOQueryPrint: TADOQuery;
RMDB_Main: TRMDBDataSet;
v1Column16: TcxGridDBColumn;
ToolButton7: TToolButton;
v1Column17: TcxGridDBColumn;
ToolButton8: TToolButton;
Panetime: TPanel;
RMBarCodeObject1: TRMBarCodeObject;
ToolButton9: TToolButton;
procedure FormDestroy(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure FormCreate(Sender: TObject);
procedure TBRafreshClick(Sender: TObject);
procedure ConNoMChange(Sender: TObject);
procedure TBCloseClick(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure TBExportClick(Sender: TObject);
procedure TBFindClick(Sender: TObject);
procedure C_CodeNameChange(Sender: TObject);
procedure TBPrintClick(Sender: TObject);
procedure conNoChange(Sender: TObject);
procedure conNoKeyPress(Sender: TObject; var Key: Char);
procedure N1Click(Sender: TObject);
procedure N2Click(Sender: TObject);
procedure TBRKCXClick(Sender: TObject);
procedure TBADDClick(Sender: TObject);
procedure TBEditClick(Sender: TObject);
procedure ToolButton2Click(Sender: TObject);
procedure CheckBox1Click(Sender: TObject);
procedure ToolButton3Click(Sender: TObject);
procedure ToolButton4Click(Sender: TObject);
procedure ToolButton5Click(Sender: TObject);
procedure ToolButton1Click(Sender: TObject);
procedure ToolButton6Click(Sender: TObject);
procedure ToolButton7Click(Sender: TObject);
procedure ToolButton8Click(Sender: TObject);
procedure ToolButton9Click(Sender: TObject);
private
TblCprk:string;
procedure InitGrid();
procedure DropTable();
procedure CreateTable();
{ Private declarations }
public
fDParameters2:string;
{ Public declarations }
end;
var
frmCKProductBCPInList_other: TfrmCKProductBCPInList_other;
implementation
uses
U_DataLink,U_Fun, U_Printckmd, U_CPRK,U_CKProductBCPOutth, U_NoteList,
U_YGList, U_RKSMEdit, U_CPRK_Other, U_RKSMEdit_Other,U_JYOrderCDOne_Other;
{$R *.dfm}
procedure TfrmCKProductBCPInList_other.DropTable();
var
strSQL:string;
begin
// TblCprk := '[##CP_INOut123' + trim(DCode) + IntToStr(Handle)+formatdatetime('hhnnsszzz',time) + ']';
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
strSQL := 'IF OBJECT_ID(''tempdb..' + TblCprk + ''') IS NOT NULL DROP TABLE ' + TblCprk;
with ADOQueryCmd do
begin
Close;
SQL.Clear;
SQL.Add(strSQL);
ExecSQL;
end;
end;
procedure TfrmCKProductBCPInList_other.CreateTable();
var
strSQL:string;
begin
TblCprk := '[##CP_RK10' + trim(DCode) + IntToStr(Handle)+formatdatetime('hhnnsszzz',time) + ']';
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
strSQL := 'IF OBJECT_ID(''tempdb..' + TblCprk + ''') IS NOT NULL DROP TABLE ' + TblCprk + #13
+ 'CREATE TABLE ' + TblCprk + ' ('
+ 'MainID VARCHAR(20),'
+ 'subID VARCHAR(20),'
+ 'BCID Varchar(20))'#13;
with ADOQueryCmd do
begin
Close;
SQL.Clear;
SQL.Add(strSQL);
ExecSQL;
end;
end;
procedure TfrmCKProductBCPInList_other.FormDestroy(Sender: TObject);
begin
frmCKProductBCPInList_other:=nil;
end;
procedure TfrmCKProductBCPInList_other.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
writeCxGrid(self.Caption,Tv1,'<27><>Ʒ<EFBFBD>ֿ<EFBFBD>');
Action:=caFree;
end;
procedure TfrmCKProductBCPInList_other.FormCreate(Sender: TObject);
begin
//cxGrid1.Align:=alClient;
BegDate.DateTime:=SGetServerDateTime(ADOQueryTemp);
EndDate.DateTime:=SGetServerDateTime(ADOQueryTemp)
end;
procedure TfrmCKProductBCPInList_other.InitGrid();
begin
screen.Cursor:=crsqlwait;
Panetime.Visible:=true;
Panetime.Left:=(Width-Panetime.Width) div 2;
Panetime.top:=(Height-Panetime.Height-200) div 2;
application.ProcessMessages;
try
ADOQueryMain.DisableControls;
with ADOQueryMain do
begin
Close;
sql.Clear;
Filtered:=False;
SQL.Add('select A.defstr1,A.defstr2,A.defstr3,A.Filler,A.FillTime,A.note,A.ThCust,A.mainID,A.subID,A.MJID,A.BCID,A.CRTime,A.CRType,A.CRID,A.Qty,A.RollNum,A.QtyUnit,A.CPType,A.CKOrdNo,A.C_CodeName,A.C_Color,A.RCgangNo,A.BCgangNO,a.kcKw,');
sql.Add('conNo=(select top 1 ConNo from WFB_MJJY X where X.MJID=A.MJID),');
sql.Add('MF.defstr7 as PrtMF,MF.defstr8 as Prtkz, ');
sql.Add('factoryNoName=(select X.Aorddefstr4 from JYOrder_Sub_AnPai X where X.APID=A.APID) ');
sql.add('from CK_BanCP_CR1 A ');
Sql.add(' LEFT join KH_Zdy_Attachment MF on MF.zdyName=A.C_CodeName and MF.defstr3=A.C_Color and MF.Type=''CP''');
sql.add('where A.CRTime>='''+Trim(FormatDateTime('yyyy-MM-dd',BegDate.DateTime))+''' ');
sql.add('and A.CRTime<'''+Trim(FormatDateTime('yyyy-MM-dd',enddate.DateTime+1))+''' ');
sql.add('and A.C_CodeName like '+quotedstr('%'+trim(C_CodeName.Text)+'%'));
sql.add('and A.C_Color like '+quotedstr('%'+trim(C_Color.Text)+'%'));
sql.add('and A.BCGangNo like '+quotedstr('%'+trim(BCGangNo.Text)+'%'));
SQL.Add('and A.CRFlag=''<27><><EFBFBD><EFBFBD>'' ');
Open;
end;
SCreateCDS20(ADOQueryMain,CDS_Main);
SInitCDSData20(ADOQueryMain,CDS_Main);
finally
ADOQueryMain.EnableControls;
TBFind.Click;
Panetime.Visible:=false;
screen.Cursor:=crdefault;
end;
end;
procedure TfrmCKProductBCPInList_other.TBRafreshClick(Sender: TObject);
begin
// BegDate.SetFocus;
InitGrid();
end;
procedure TfrmCKProductBCPInList_other.ConNoMChange(Sender: TObject);
begin
if ADOQueryMain.Active then
begin
SDofilter(ADOQueryMain,SGetFilters(Panel1,1,2));
end;
end;
procedure TfrmCKProductBCPInList_other.TBCloseClick(Sender: TObject);
begin
//ReadCxGrid(self.Caption,Tv1,'<27><>Ʒ<EFBFBD>ֿ<EFBFBD>');
Close;
end;
procedure TfrmCKProductBCPInList_other.FormShow(Sender: TObject);
begin
ReadCxGrid(self.Caption,Tv1,'<27><>Ʒ<EFBFBD>ֿ<EFBFBD>');
if Trim(fDParameters2)='<27><><EFBFBD><EFBFBD>' then
begin
TBRKCX.Visible:=True;
end;
if Trim(fDParameters2)='<27><>ѯ' then
begin
TBADD.Visible:=false;
TBEdit.Visible:=false;
TBRKCX.Visible:=false;
ToolButton3.Visible:=false;
ToolButton4.Visible:=false;
ToolButton5.Visible:=false;
end;
//InitGrid();
end;
procedure TfrmCKProductBCPInList_other.TBExportClick(Sender: TObject);
begin
if ADOQueryMain.IsEmpty then exit;
TcxGridToExcel('<27><><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>',cxGrid2);
end;
procedure TfrmCKProductBCPInList_other.TBFindClick(Sender: TObject);
var
strwhere:string;
begin
if ADOQueryMain.Active then
begin
strwhere:= SGetFilters(Panel1,1,2);
SDofilter(ADOQueryMain,strwhere);
SCreateCDS20(ADOQueryMain,CDS_Main);
SInitCDSData20(ADOQueryMain,CDS_Main);
end;
end;
procedure TfrmCKProductBCPInList_other.C_CodeNameChange(Sender: TObject);
begin
TBFind.Click;
end;
procedure TfrmCKProductBCPInList_other.TBPrintClick(Sender: TObject);
var
filepath:string;
begin
if CDS_Main.IsEmpty then exit;
if CDS_Main.Locate('ssel',true,[])=false then
begin
Application.MessageBox(<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!','<27><>ʾ',0);
Exit;
end;
CreateTable();
with CDS_Main do
begin
DisableControls;
first;
while not eof do
begin
IF Fieldbyname('ssel').AsBoolean then
begin
with adoqueryCmd do
begin
Close;
SQL.Clear;
SQL.Add(' insert into '+TblCprk+'(BCID) values( ');
SQL.Add(' '+quotedstr(trim(CDS_Main.fieldbyname('BCID').AsString)));
sql.add(')');
execsql;
end;
end;
next;
end;
First;
EnableControls;
end;
with AdoPrint do
begin
close;
sql.Clear;
sql.Add('exec P_Get_CprkList ');
sql.Add('@mainID='+quotedstr(trim('')));
sql.Add(',@TblCprk='+quotedstr(trim(TblCprk)));
sql.Add(',@flag='+quotedstr(trim('1')));
open;
end;
with AdoPrint1 do
begin
close;
sql.Clear;
sql.Add('exec P_Get_CprkList ');
sql.Add('@mainID='+quotedstr(trim('')));
sql.Add(',@TblCprk='+quotedstr(trim(TblCprk)));
sql.Add(',@flag='+quotedstr(trim('10')));
open;
end;
try
filepath:=ExtractFilePath(Application.ExeName) + 'report\<5C><>Ʒ<EFBFBD><C6B7><EFBFBD>ⵥ.rmf';
if not FileExists(Pchar(filepath)) then
begin
application.MessageBox(pchar('<27>ļ<EFBFBD>['+filepath+']<5D><><EFBFBD><EFBFBD><EFBFBD>ڣ<EFBFBD>'),'<27><>ʾ<EFBFBD><CABE>Ϣ',MB_IConError);
exit;
end;
RMVariables['begdate'] :=FormatDateTime('yyyy-MM-dd',BegDate.DateTime)+' - '+FormatDateTime('yyyy-MM-dd',enddate.DateTime);
RMVariables['dtxz'] :=FormatDateTime('yyyy-mm-dd',date());
RMVariables['zdr'] :=trim(DName);
// RMVariables['Filler'] :=trim(CDS_Main.fieldbyname('Filler').AsString);
RM1.LoadFromFile(filepath);
RM1.ShowReport;
finally
end;
DropTable();
end;
procedure TfrmCKProductBCPInList_other.conNoChange(Sender: TObject);
begin
// if Length(Trim(conNo.Text))<4 then Exit;
TBFind.Click;
end;
procedure TfrmCKProductBCPInList_other.conNoKeyPress(Sender: TObject;
var Key: Char);
begin
{ if Key=#13 then
begin
if Length(Trim(conNo.Text))<4 then Exit;
try
ADOQueryMain.DisableControls;
with ADOQueryMain do
begin
Filtered:=False;
Close;
sql.Clear;
SQL.Add('select A.*,B.ConNo,C.C_Color,C.MF,C.KZ,D.MJXH');
sql.Add(',isnull(factoryNoName,B.ConNo) KHName');
sql.Add(',E.AOrdDefStr1');
sql.add('from CK_BanCP_CR A ');
Sql.add(' left join Contract_Main B on A.MainId=B.MainId');
Sql.add(' left join Contract_sub C on A.SubId=C.SubId');
Sql.add(' left join WFB_MJJY D on A.MJId=D.MJId');
sql.Add(' left join JYOrder_Sub_AnPai E on A.APID=E.APID');
sql.add('where A.orderNo
SQL.Add(' and CRFlag=''<27><><EFBFBD><EFBFBD>'' ');
Parameters.ParamByName('orderNo').Value:='%'+Trim(conNo.Text)+'%';
Open;
//ShowMessage(SQL.Text);
end;
SCreateCDS20(ADOQueryMain,CDS_Main);
SInitCDSData20(ADOQueryMain,CDS_Main);
finally
ADOQueryMain.EnableControls;
end;
end; }
end;
procedure TfrmCKProductBCPInList_other.N1Click(Sender: TObject);
begin
SelOKNo(CDS_Main,True);
end;
procedure TfrmCKProductBCPInList_other.N2Click(Sender: TObject);
begin
SelOKNo(CDS_Main,False);
end;
procedure TfrmCKProductBCPInList_other.TBRKCXClick(Sender: TObject);
var
YFID,CRID:string;
begin
if CDS_Main.IsEmpty then Exit;
if CDS_Main.Locate('SSel',True,[])=False then
begin
Application.MessageBox(<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!','<27><>ʾ',0);
Exit;
end;
if Application.MessageBox(<><C8B7>Ҫִ<D2AA>в<EFBFBD><D0B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<27><>ʾ',32+4)<>IDYES then Exit;
BegDate.SetFocus;
try
ADOQueryCmd.Connection.BeginTrans;
with CDS_Main do
begin
while Locate('SSel',True,[]) do
begin
IF (trim(CDS_Main.fieldbyname('CRType').AsString)='<27>˻<EFBFBD><CBBB><EFBFBD><EFBFBD><EFBFBD>') or
(trim(CDS_Main.fieldbyname('CRType').AsString)='<27>ɹ<EFBFBD><C9B9><EFBFBD><EFBFBD><EFBFBD>') then
begin
with ADOQueryTemp do
begin
Close;
sql.Clear;
sql.Add('select * from YF_Money_CR ');
sql.Add(' where MainID='''+Trim(CDS_Main.fieldbyname('ckordNo').AsString)+'''');
sql.Add(' and P_COdeName='''+Trim(CDS_Main.fieldbyname('C_COdeName').AsString)+'''');
sql.Add(' and P_Color='''+Trim(CDS_Main.fieldbyname('C_COlor').AsString)+'''');
sql.Add(' and YFName IN(''<27>˻<EFBFBD><CBBB><EFBFBD><EFBFBD><EFBFBD>'',''<27>ɹ<EFBFBD><C9B9><EFBFBD><EFBFBD><EFBFBD>'') ');
sql.Add(' and status>=''1'' ');
Open;
if not IsEmpty then
begin
ADOQueryCmd.Connection.RollbackTrans;
Application.MessageBox(<>տ<EFBFBD><D5BF><EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD>û<EFBFBD>г<EFBFBD><D0B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˣ<EFBFBD><CBA3><EFBFBD><EFBFBD>ܳ<EFBFBD><DCB3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!','<27><>ʾ',0);
Exit;
end;
end;
with ADOQueryTemp do
begin
Close;
sql.Clear;
sql.Add('select * from YF_Money_CR ');
sql.Add(' where MainID='''+Trim(CDS_Main.fieldbyname('ckordNo').AsString)+'''');
sql.Add(' and P_COdeName='''+Trim(CDS_Main.fieldbyname('C_COdeName').AsString)+'''');
sql.Add(' and P_Color='''+Trim(CDS_Main.fieldbyname('C_COlor').AsString)+'''');
sql.Add(' and YFName='''+Trim(CDS_Main.fieldbyname('CRType').AsString)+'''');
Open;
if not IsEmpty then
begin
YFID:=Fieldbyname('YFID').AsString;
CRID:=Fieldbyname('CRID').AsString;
end;
end;
end;
with ADOQueryTemp do
begin
Close;
sql.Clear;
sql.Add('select * from CK_BanCP_CR1 where CRID='+Trim(CDS_Main.fieldbyname('CRID').AsString));
Open;
end;
if ADOQueryTemp.RecordCount>1 then
begin
ADOQueryCmd.Connection.RollbackTrans;
Application.MessageBox('<27>ѳ<EFBFBD><D1B3><EFBFBD>ܳ<EFBFBD><DCB3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!','<27><>ʾ',0);
Exit;
end;
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('delete CK_BanCP_CR1 where BCID='''+Trim(CDS_Main.fieldbyname('BCID').AsString)+'''');
sql.Add('delete CK_BanCP_KC1 where CRID='+Trim(CDS_Main.fieldbyname('CRID').AsString));
sql.Add('Update WFB_MJJY Set MJStr2='<><CEB4><EFBFBD><EFBFBD>'' where MJID='''+Trim(CDS_Main.fieldbyname('MJID').AsString)+'''');
IF trim(CDS_Main.fieldbyname('CRType').AsString)='<27>˻<EFBFBD><CBBB><EFBFBD><EFBFBD><EFBFBD>' then
begin
sql.Add('update YF_Money_CR Set Qty=(select -1*isnull(Sum(Qty),0) from CK_BanCP_CR1 A ');
sql.Add(' where A.ckordNo=YF_Money_CR.mainID and A.C_COdeName=YF_Money_CR.P_CodeName and A.C_Color=YF_Money_CR.P_Color and A.CRType=''<27>˻<EFBFBD><CBBB><EFBFBD><EFBFBD><EFBFBD>'' )');
sql.Add(',PS=(select -1* isnull(count(*),0) from CK_BanCP_CR1 A ');
sql.Add(' where A.ckordNo=YF_Money_CR.mainID and A.C_COdeName=YF_Money_CR.P_CodeName and A.C_Color=YF_Money_CR.P_Color and A.CRType=''<27>˻<EFBFBD><CBBB><EFBFBD><EFBFBD><EFBFBD>'' )');
sql.Add(' where YFID='''+Trim(YFID)+'''');
end;
IF trim(CDS_Main.fieldbyname('CRType').AsString)='<27>ɹ<EFBFBD><C9B9><EFBFBD><EFBFBD><EFBFBD>' then
begin
sql.Add('update YF_Money_CR Set Qty=(select isnull(Sum(Qty),0) from CK_BanCP_CR1 A ');
sql.Add(' where A.ckordNo=YF_Money_CR.mainID and A.C_COdeName=YF_Money_CR.P_CodeName and A.C_Color=YF_Money_CR.P_Color and A.CRType=''<27>˻<EFBFBD><CBBB><EFBFBD><EFBFBD><EFBFBD>'' )');
sql.Add(',PS=(select isnull(count(*),0) from CK_BanCP_CR1 A ');
sql.Add(' where A.ckordNo=YF_Money_CR.mainID and A.C_COdeName=YF_Money_CR.P_CodeName and A.C_Color=YF_Money_CR.P_Color and A.CRType=''<27>˻<EFBFBD><CBBB><EFBFBD><EFBFBD><EFBFBD>'' )');
sql.Add(' where YFID='''+Trim(YFID)+'''');
end;
sql.Add('delete from YF_Money_CR ');
sql.Add('where YFID='''+Trim(YFID)+''' and Qty=0 ');
sql.Add('Update YF_Money_CR Set Money=Price*Qty,BBMoney=Price*Qty*HuiLv');
sql.Add(' where YFID='''+Trim(YFID)+'''');
sql.Add('Update YF_Money_KC Set KCMoney=(select isnull(Sum(Money*QtyFlag),0) from YF_Money_CR A where A.CRID=YF_Money_KC.CRID)');
sql.Add(',KCBBMoney=(select isnull(Sum(BBMoney*QtyFlag),0) from YF_Money_CR A where A.CRID=YF_Money_KC.CRID)');
sql.Add(' where CRID='''+Trim(CRID)+'''');
ExecSQL;
end;
CDS_Main.Delete;
end;
end;
ADOQueryCmd.Connection.CommitTrans;
except
ADOQueryCmd.Connection.RollbackTrans;
Application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>!','<27><>ʾ',0);
end;
end;
procedure TfrmCKProductBCPInList_other.TBADDClick(Sender: TObject);
begin
frmCPRK_Other:=TfrmCPRK_Other.create(self);
with frmCPRK_Other do
begin
if Trim(DParameters2)<>'<27><><EFBFBD><EFBFBD>' then
begin
CRType.Items.Clear;
CRType.Items.Add('<27>˻<EFBFBD><CBBB><EFBFBD><EFBFBD><EFBFBD>');
// CRType.Items.Add('<27>ɹ<EFBFBD><C9B9><EFBFBD><EFBFBD><EFBFBD>');
CRType.ItemIndex:=0;
end;
fFlag:=0;
fkeyNo:='';
fBCID:='';
if showmodal=1 then
begin
TBRafresh.Click;
end;
free;
end;
end;
procedure TfrmCKProductBCPInList_other.TBEditClick(Sender: TObject);
begin
if CDS_Main.IsEmpty then exit;
if (trim(CDS_Main.fieldbyname('CRType').AsString)<>'<27>ڳ<EFBFBD><DAB3><EFBFBD><EFBFBD><EFBFBD>') and
(trim(CDS_Main.fieldbyname('CRType').AsString)<>'<27>˻<EFBFBD><CBBB><EFBFBD><EFBFBD><EFBFBD>') then
begin
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ڳ<EFBFBD><DAB3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˻<EFBFBD><CBBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>޸<EFBFBD>','<27><>ʾ<EFBFBD><CABE>Ϣ',0);
exit;
end;
with ADOQueryCmd do
begin
close;
sql.Clear;
sql.Add('select A.* from CK_BanCP_KC1 A ');
sql.Add('inner join CK_BanCP_CR1 B on B.crid=A.crid and B.MJID=A.MJID ');
sql.Add('where (A.KCQty<>B.Qty or A.kcRollNum <> B.RollNum or isnull(A.KCStatus,''0'')>''0'') ');
sql.Add('and B.CKOrdNo='+quotedstr(trim(CDS_Main.fieldbyname('ckordNo').AsString)));
sql.Add('and B.BCID='+quotedstr(trim(CDS_Main.fieldbyname('BCID').AsString)));
open;
end;
if not ADOQueryCmd.IsEmpty then
begin
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѳ<EFBFBD><D1B3><EFBFBD><E2A3AC><EFBFBD><EFBFBD><EFBFBD>޸<EFBFBD>','<27><>ʾ<EFBFBD><CABE>Ϣ',0);
exit;
end;
frmCPRK_Other:=TfrmCPRK_Other.create(self);
with frmCPRK_Other do
begin
fFlag:=1;
fkeyNo:=self.CDS_Main.fieldbyname('ckordNo').AsString;
fBCID:=self.CDS_Main.fieldbyname('BCID').AsString;
if showmodal=1 then
begin
self.InitGrid();
end;
free;
end;
end;
procedure TfrmCKProductBCPInList_other.ToolButton2Click(Sender: TObject);
begin
frmCKProductBCPOutth:=TfrmCKProductBCPOutth.create(self);
with frmCKProductBCPOutth do
begin
if showmodal=1 then
begin
self.TBRafresh.Click;
end;
Release;
end;
end;
procedure TfrmCKProductBCPInList_other.CheckBox1Click(Sender: TObject);
begin
IF CDS_Main.IsEmpty then exit;
with CDS_Main do
begin
DisableControls;
first;
while not eof do
begin
edit;
fieldbyname('ssel').Value:=checkbox1.Checked;
post;
next;
end;
First;
EnableControls;
end;
end;
procedure TfrmCKProductBCPInList_other.ToolButton3Click(Sender: TObject);
begin
IF CDS_Main.IsEmpty then exit;
frmYGlist:=TfrmYGlist.create(self);
with frmYGlist do
begin
frmYGlist.Caption:='<27><><EFBFBD>Ӵ<EFBFBD><D3B4><EFBFBD><EFBFBD><EFBFBD>';
frmYGlist.Label1.Caption:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
if showmodal=1 then
begin
// Fnote:=trim(Memo1.Text);
with CDS_Main do
begin
DisableControls;
first;
while not eof do
begin
IF Fieldbyname('ssel').AsBoolean then
begin
with ADOQueryCmd do
begin
close;
sql.Clear;
sql.Add('update CK_Bancp_CR SET defstr1='+quotedstr(trim(Memo1.Text)));
sql.Add('where BCID='+quotedstr(trim(CDS_Main.fieldbyname('BCID').AsString)));
execsql;
end;
end;
next;
end;
First;
EnableControls;
end;
TBRafresh.Click;
end;
close;
end;
end;
procedure TfrmCKProductBCPInList_other.ToolButton4Click(Sender: TObject);
begin
IF CDS_Main.IsEmpty then exit;
frmYGlist:=TfrmYGlist.create(self);
with frmYGlist do
begin
frmYGlist.Caption:='<27><><EFBFBD>ӳ<EFBFBD><D3B3><EFBFBD><EFBFBD><EFBFBD>';
frmYGlist.Label1.Caption:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
if showmodal=1 then
begin
// Fnote:=trim(Memo1.Text);
with CDS_Main do
begin
DisableControls;
first;
while not eof do
begin
IF Fieldbyname('ssel').AsBoolean then
begin
with ADOQueryCmd do
begin
close;
sql.Clear;
sql.Add('update CK_Bancp_CR SET defstr2='+quotedstr(trim(Memo1.Text)));
sql.Add('where BCID='+quotedstr(trim(CDS_Main.fieldbyname('BCID').AsString)));
execsql;
end;
end;
next;
end;
First;
EnableControls;
end;
TBRafresh.Click;
end;
close;
end;
end;
procedure TfrmCKProductBCPInList_other.ToolButton5Click(Sender: TObject);
begin
IF CDS_Main.IsEmpty then exit;
frmYGlist:=TfrmYGlist.create(self);
with frmYGlist do
begin
frmYGlist.Caption:='<27><><EFBFBD><EFBFBD><EFBFBD>ϼ<EFBFBD><CFBC><EFBFBD>';
frmYGlist.Label1.Caption:='<27>ϼ<EFBFBD><CFBC><EFBFBD>';
if showmodal=1 then
begin
// Fnote:=trim(Memo1.Text);
with CDS_Main do
begin
DisableControls;
first;
while not eof do
begin
IF Fieldbyname('ssel').AsBoolean then
begin
with ADOQueryCmd do
begin
close;
sql.Clear;
sql.Add('update CK_Bancp_CR SET defstr3='+quotedstr(trim(Memo1.Text)));
sql.Add('where BCID='+quotedstr(trim(CDS_Main.fieldbyname('BCID').AsString)));
execsql;
end;
end;
next;
end;
First;
EnableControls;
end;
TBRafresh.Click;
end;
close;
end;
end;
procedure TfrmCKProductBCPInList_other.ToolButton1Click(Sender: TObject);
begin
try
frmRKSMEdit_other:=TfrmRKSMEdit_other.Create(Application);
with frmRKSMEdit_other do
begin
if ShowModal=1 then
begin
end;
end;
finally
frmRKSMEdit_other.Free;
end;
end;
procedure TfrmCKProductBCPInList_other.ToolButton6Click(Sender: TObject);
var
fPrintFile:string;
Txt,fImagePath:string;
Moudle: THandle;
Makebar:TMakebar;
Mixtext:TMixtext;
begin
if CDS_Main.IsEmpty then Exit;
if CDS_Main.Locate('SSel',True,[])=False then
begin
Application.MessageBox(<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!','<27><>ʾ',0);
Exit;
end;
CDS_Main.DisableControls;
with CDS_Main do
begin
First;
while not Eof do
begin
if CDS_Main.FieldByName('SSel').AsBoolean=True then
begin
try
Moudle:=LoadLibrary('MakeQRBarcode.dll');
@Makebar:=GetProcAddress(Moudle,'Make');
@Mixtext:=GetProcAddress(Moudle,'MixText');
Txt:=Trim(CDS_Main.fieldbyname('MJID').AsString);
fImagePath:=ExtractFilePath(Application.ExeName)+'image\temp.bmp';
if not DirectoryExists(pchar(ExtractFilePath(Application.ExeName)+'image')) then
CreateDirectory(pchar(ExtractFilePath(Application.ExeName)+'image'),nil);
if FileExists(fImagePath) then DeleteFile(fImagePath);
Makebar(pchar(Txt),Length(Txt),3,3,0,PChar(fImagePath),3);
except
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>','<27><>ʾ<EFBFBD><CABE>Ϣ',MB_ICONERROR);
CDS_Main.EnableControls;
exit;
end;
with ADOQueryPrint do //Ӣ<><D3A2><EFBFBD><EFBFBD><EFBFBD>Ʋ<EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD>Ʒ<EFBFBD><C6B7><EFBFBD>ж<EFBFBD>ȡ<EFBFBD><C8A1>Ҫ<EFBFBD>ڿͻ<DABF><CDBB>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD>ȡ<EFBFBD><C8A1>note<74>ֶΡ<D6B6>
begin
Close;
SQL.Clear;
sql.Add('select A.*,Qty as mjlen,QtyUnit as MJTypeother ');
sql.Add(' from CK_BanCP_CR1 A') ;
SQL.Add(' where A.MJID='''+Trim(CDS_Main.fieldbyname('MJID').AsString)+'''');
SQL.Add(' and Qty>0 and CRFlag=''<27><><EFBFBD><EFBFBD>'' ');
Open;
end;
fPrintFile:=ExtractFilePath(Application.ExeName)+'Report\ͨ<>ñ<EFBFBD>ǩ.rmf' ;
if FileExists(fPrintFile) then
begin
RMVariables['QRBARCODE']:=fImagePath;
RMGridReport1.LoadFromFile(fPrintFile);
// RMGridReport1.ShowReport;
RMGridReport1.PrintReport;
end else
begin
CDS_Main.EnableControls;
Application.MessageBox(PChar(<><C3BB><EFBFBD><EFBFBD>'+ExtractFilePath(Application.ExeName)+'Report\<5C><><EFBFBD><EFBFBD>ǩ.rmf'),'<27><>ʾ',0);
Exit;
end;
end;
Next;
end;
end;
CDS_Main.EnableControls;
end;
procedure TfrmCKProductBCPInList_other.ToolButton7Click(Sender: TObject);
var
fPrintFile:string;
Txt,fImagePath:string;
Moudle: THandle;
Makebar:TMakebar;
Mixtext:TMixtext;
begin
if CDS_Main.IsEmpty then Exit;
IF trim(CDS_Main.FieldByName('CRType').AsString)<>'<27>˻<EFBFBD><CBBB><EFBFBD><EFBFBD><EFBFBD>' then
begin
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>˻<EFBFBD><CBBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD>ܴ<EFBFBD>ӡ<EFBFBD><D3A1>','<27><>ʾ<EFBFBD><CABE>Ϣ',0);
exit;
end;
{ with AdoPrint do
begin
close;
sql.Clear;
sql.Add('select * from CK_BanCp_CR1 ');
sql.Add('where CKordNo='+quotedstr(trim(CDS_Main.fieldbyname('CKordNo').AsString)));
open;
end; }
CreateTable();
with AdoPrint do
begin
close;
sql.Clear;
sql.Add('exec P_Do_PrintMd10 ');
sql.Add('@mainID='+quotedstr(trim(CDS_Main.fieldbyname('CKordNo').AsString)));
sql.Add(',@TblCprk='+quotedstr(trim(TblCprk)));
sql.Add(',@flag='+quotedstr(trim('<27>˻<EFBFBD><CBBB><EFBFBD><EFBFBD><EFBFBD>2')));
open;
end;
DropTable();
{ try
Moudle:=LoadLibrary('MakeQRBarcode.dll');
@Makebar:=GetProcAddress(Moudle,'Make');
@Mixtext:=GetProcAddress(Moudle,'MixText');
Txt:=Trim(AdoPrint.fieldbyname('CKordNo').AsString);
fImagePath:=ExtractFilePath(Application.ExeName)+'image\temp.bmp';
if not DirectoryExists(pchar(ExtractFilePath(Application.ExeName)+'image')) then
CreateDirectory(pchar(ExtractFilePath(Application.ExeName)+'image'),nil);
if FileExists(fImagePath) then DeleteFile(fImagePath);
Makebar(pchar(Txt),Length(Txt),3,3,0,PChar(fImagePath),3);
except
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>','<27><>ʾ<EFBFBD><CABE>Ϣ',MB_ICONERROR);
CDS_Main.EnableControls;
exit;
end;
}
try
fPrintFile:=ExtractFilePath(Application.ExeName) + 'report\<5C><>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD><EFBFBD>˻<EFBFBD><CBBB><EFBFBD>2.rmf';
if not FileExists(Pchar(fPrintFile)) then
begin
application.MessageBox(pchar('<27>ļ<EFBFBD>['+fPrintFile+']<5D><><EFBFBD><EFBFBD><EFBFBD>ڣ<EFBFBD>'),'<27><>ʾ<EFBFBD><CABE>Ϣ',MB_IConError);
exit;
end;
RMVariables['QRBARCODE']:=fImagePath;
// RMVariables['begdate'] :=FormatDateTime('yyyy-MM-dd',BegDate.DateTime)+' - '+FormatDateTime('yyyy-MM-dd',enddate.DateTime);
RMVariables['dtxz'] :=FormatDateTime('yyyy-mm-dd',date());
RMVariables['zdr'] :=trim(DName);
// RMVariables['Filler'] :=trim(CDS_Main.fieldbyname('Filler').AsString);
RM1.LoadFromFile(fPrintFile);
RM1.ShowReport;
finally
end;
end;
procedure TfrmCKProductBCPInList_other.ToolButton8Click(Sender: TObject);
begin
IF CDS_Main.IsEmpty then exit;
frmYGlist:=TfrmYGlist.create(self);
with frmYGlist do
begin
frmYGlist.Caption:='<27><><EFBFBD><EFBFBD><EFBFBD>̲<EFBFBD><CCB2><EFBFBD>';
frmYGlist.Label1.Caption:='<27>̲<EFBFBD><CCB2><EFBFBD>';
if showmodal=1 then
begin
// Fnote:=trim(Memo1.Text);
with CDS_Main do
begin
DisableControls;
first;
while not eof do
begin
IF Fieldbyname('ssel').AsBoolean then
begin
with ADOQueryCmd do
begin
close;
sql.Clear;
sql.Add('update CK_Bancp_CR SET defstr4='+quotedstr(trim(Memo1.Text)));
sql.Add('where BCID='+quotedstr(trim(CDS_Main.fieldbyname('BCID').AsString)));
execsql;
end;
end;
next;
end;
First;
EnableControls;
end;
TBRafresh.Click;
end;
close;
end;
end;
procedure TfrmCKProductBCPInList_other.ToolButton9Click(Sender: TObject);
begin
frmJYOrderCDOne_other:=TfrmJYOrderCDOne_other.Create(self);
with frmJYOrderCDOne_other do
begin
trk.Visible:=true;
ToolButton1.Visible:=false;
MJStr2.ItemIndex:=MJStr2.Items.IndexOf(<><CEB4><EFBFBD><EFBFBD>');
MJStr2.Enabled:=false;
if showmodal=1 then
begin
end;
free;
end;
end;
end.