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

2883 lines
97 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_ProductOrder_Ph;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls, ComCtrls, ToolWin, cxStyles, cxCustomData,
cxGraphics, cxFilter, cxData, cxDataStorage, cxEdit, DB, cxDBData, ADODB,
cxGridCustomPopupMenu, cxGridPopupMenu, cxGridLevel, cxClasses, cxControls,
cxGridCustomView, cxGridCustomTableView, cxGridTableView, cxGridDBTableView,
cxGrid, DBClient, cxCheckBox, cxCalendar, cxSplitter, RM_Dataset, RM_System,
RM_Common, RM_Class, RM_GridReport, RM_e_Xls, Menus, cxPC, cxContainer,
cxTextEdit, cxCurrencyEdit, cxLookAndFeels, cxLookAndFeelPainters, cxNavigator,
dxBarBuiltInMenu, dxSkinsCore, dxSkinBlack, dxSkinBlue, dxSkinBlueprint,
dxSkinCaramel, dxSkinCoffee, dxSkinDarkRoom, dxSkinDarkSide,
dxSkinDevExpressDarkStyle, dxSkinDevExpressStyle, dxSkinFoggy,
dxSkinGlassOceans, dxSkinHighContrast, dxSkiniMaginary, dxSkinLilian,
dxSkinLiquidSky, dxSkinLondonLiquidSky, dxSkinMcSkin, dxSkinMetropolis,
dxSkinMetropolisDark, dxSkinMoneyTwins, dxSkinOffice2007Black,
dxSkinOffice2007Blue, dxSkinOffice2007Green, dxSkinOffice2007Pink,
dxSkinOffice2007Silver, dxSkinOffice2010Black, dxSkinOffice2010Blue,
dxSkinOffice2010Silver, dxSkinOffice2013DarkGray, dxSkinOffice2013LightGray,
dxSkinOffice2013White, dxSkinPumpkin, dxSkinSeven, dxSkinSevenClassic,
dxSkinSharp, dxSkinSharpPlus, dxSkinSilver, dxSkinSpringTime, dxSkinStardust,
dxSkinSummer2008, dxSkinTheAsphaltWorld, dxSkinsDefaultPainters,
dxSkinValentine, dxSkinVS2010, dxSkinWhiteprint, dxSkinXmas2008Blue,
dxSkinscxPCPainter;
type
TfrmProductOrder_Ph = class(TForm)
ToolBar1: TToolBar;
TBRafresh: TToolButton;
TBFind: TToolButton;
TBAdd: TToolButton;
TBEdit: TToolButton;
TBDel: TToolButton;
TBPrint: TToolButton;
TBClose: TToolButton;
Panel1: TPanel;
BegDate: TDateTimePicker;
EndDate: TDateTimePicker;
Label1: TLabel;
Tv1: TcxGridDBTableView;
cxGrid1Level1: TcxGridLevel;
cxGrid1: TcxGrid;
cxGridPopupMenu1: TcxGridPopupMenu;
ADOQueryCmd: TADOQuery;
ADOQueryMain: TADOQuery;
ADOQueryTemp: TADOQuery;
DataSource1: TDataSource;
Label3: TLabel;
OrderNo: TEdit;
TBExport: TToolButton;
v1OrderNo: TcxGridDBColumn;
v1JGFactoryName: TcxGridDBColumn;
v1OrdDate: TcxGridDBColumn;
v1DeliveryDate: TcxGridDBColumn;
v1OrdPerson1: TcxGridDBColumn;
Order_Main: TClientDataSet;
RM1: TRMGridReport;
RMDBMain: TRMDBDataSet;
RMXLSExport1: TRMXLSExport;
v1CustomerNoName: TcxGridDBColumn;
Label4: TLabel;
CustomerNoName: TEdit;
v1MPRTCodeName: TcxGridDBColumn;
v1PRTOrderQty: TcxGridDBColumn;
PopupMenu1: TPopupMenu;
N2: TMenuItem;
ToolButton1: TToolButton;
Label2: TLabel;
JGFactoryName: TEdit;
Label5: TLabel;
OrdPerson1: TEdit;
Label6: TLabel;
PRTCF: TEdit;
Label7: TLabel;
PRTColor: TEdit;
Label8: TLabel;
PRTCodeName: TEdit;
Label9: TLabel;
ConNo: TEdit;
v1Column8: TcxGridDBColumn;
v1OrdDefStr1: TcxGridDBColumn;
v1Column1: TcxGridDBColumn;
Label10: TLabel;
PRTSpec: TEdit;
Label11: TLabel;
OrdDefStr1: TEdit;
Label12: TLabel;
PRTKZ: TEdit;
Label13: TLabel;
PRTMF: TEdit;
ToolButton2: TToolButton;
ADOQueryPrint: TADOQuery;
CDS_Print: TClientDataSet;
ToolButton3: TToolButton;
v1Column4: TcxGridDBColumn;
ComboBox1: TComboBox;
v1Column2: TcxGridDBColumn;
v1PRTRollNum: TcxGridDBColumn;
cxTabControl1: TcxTabControl;
ToolBar2: TToolBar;
TV2: TcxGridDBTableView;
cxGrid2Level1: TcxGridLevel;
cxGrid2: TcxGrid;
del: TToolButton;
V2Column1: TcxGridDBColumn;
V2Column2: TcxGridDBColumn;
V2Column3: TcxGridDBColumn;
V2Column4: TcxGridDBColumn;
V2Column5: TcxGridDBColumn;
phwc: TToolButton;
phok: TToolButton;
fh: TToolButton;
V2Column7: TcxGridDBColumn;
V2Column8: TcxGridDBColumn;
V2Column9: TcxGridDBColumn;
ADO_PH: TADOQuery;
DS_PH: TDataSource;
CDS_PH: TClientDataSet;
V2Column10: TcxGridDBColumn;
Panel3: TPanel;
Panel2: TPanel;
Edit1: TEdit;
Label14: TLabel;
ToolButton4: TToolButton;
v1PRTColor: TcxGridDBColumn;
V2C_Color: TcxGridDBColumn;
ToolButton5: TToolButton;
TBPrint1: TToolButton;
ADOPrint: TADOQuery;
RMDB_MD: TRMDBDataSet;
RMGridReport1: TRMGridReport;
RMXLSExport2: TRMXLSExport;
Label15: TLabel;
CRdate: TDateTimePicker;
V2Column6: TcxGridDBColumn;
V2Column11: TcxGridDBColumn;
ToolButton6: TToolButton;
v1Ssel: TcxGridDBColumn;
V2Column12: TcxGridDBColumn;
v1Column5: TcxGridDBColumn;
V2Filler: TcxGridDBColumn;
V2PHYG: TcxGridDBColumn;
v1Column6: TcxGridDBColumn;
v1Column7: TcxGridDBColumn;
CheckBox1: TCheckBox;
TBPrint2: TToolButton;
Label16: TLabel;
Label17: TLabel;
fRoll1: TcxCurrencyEdit;
fnum1: TcxCurrencyEdit;
ToolButton7: TToolButton;
v1orddefNote1: TcxGridDBColumn;
ToolButton8: TToolButton;
V2Column13: TcxGridDBColumn;
CheckBox2: TCheckBox;
ToolButton9: TToolButton;
RMDB_Main: TRMDBDataSet;
cxGridPopupMenu2: TcxGridPopupMenu;
v1Column9: TcxGridDBColumn;
Tdbchexiao: TToolButton;
v1Column10: TcxGridDBColumn;
Tv1Column1: TcxGridDBColumn;
procedure FormDestroy(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure FormCreate(Sender: TObject);
procedure TBCloseClick(Sender: TObject);
procedure TBFindClick(Sender: TObject);
procedure TBEditClick(Sender: TObject);
procedure TBDelClick(Sender: TObject);
procedure TBExportClick(Sender: TObject);
procedure TBPrintClick(Sender: TObject);
procedure TBRafreshClick(Sender: TObject);
procedure TBAddClick(Sender: TObject);
procedure OrderNoChange(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure Tv1CellDblClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
procedure TBTPClick(Sender: TObject);
procedure CheckBox1Click(Sender: TObject);
procedure CheckBox2Click(Sender: TObject);
procedure Tv1StylesGetContentStyle(Sender: TcxCustomGridTableView; ARecord: TcxCustomGridRecord; AItem: TcxCustomGridTableItem; out AStyle: TcxStyle);
procedure v1DeliveryDateCustomDrawCell(Sender: TcxCustomGridTableView; ACanvas: TcxCanvas; AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
procedure N1Click(Sender: TObject);
procedure N2Click(Sender: TObject);
procedure ToolButton1Click(Sender: TObject);
procedure ToolButton2Click(Sender: TObject);
procedure ToolButton3Click(Sender: TObject);
procedure OrderNoKeyPress(Sender: TObject; var Key: Char);
procedure ConNoKeyPress(Sender: TObject; var Key: Char);
procedure Edit1KeyPress(Sender: TObject; var Key: Char);
procedure phwcClick(Sender: TObject);
procedure cxTabControl1Change(Sender: TObject);
procedure phokClick(Sender: TObject);
procedure delClick(Sender: TObject);
procedure fhClick(Sender: TObject);
procedure ToolButton4Click(Sender: TObject);
procedure ToolButton5Click(Sender: TObject);
procedure TBPrint1Click(Sender: TObject);
procedure ToolButton6Click(Sender: TObject);
procedure Tv1FocusedRecordChanged(Sender: TcxCustomGridTableView; APrevFocusedRecord, AFocusedRecord: TcxCustomGridRecord; ANewItemRecordFocusingChanged: Boolean);
procedure TBPrint2Click(Sender: TObject);
procedure ToolButton7Click(Sender: TObject);
procedure ToolButton8Click(Sender: TObject);
procedure ToolButton9Click(Sender: TObject);
procedure TdbchexiaoClick(Sender: TObject);
private
DQdate: TDateTime;
TblCprk: string;
procedure InitGrid();
procedure InitPH();
procedure InitForm();
function DelData(): Boolean;
procedure InitGridFH();
procedure Query_MJ(mjid: string);
function SaveData(): Boolean;
function YSData(Order_Main10: TClientDataSet): Boolean;
function YSData_other(Order_Main10: TClientDataSet; FYFName: string; fMoney: double): Boolean;
function SaveEjK(FNO, FID, fBCID, fCkNO: string): boolean;
function SaveEjK10(FNO, FID, fBCID, fCkNO: string): boolean;
procedure CreateTable();
procedure DropTable();
{ Private declarations }
public
fDParameters1: string;
FFInt, FCloth: Integer;
{ Public declarations }
end;
var
frmProductOrder_Ph: TfrmProductOrder_Ph;
implementation
uses
U_DataLink, U_OrderInPut, U_Fun, U_CKProductBCPKCListSel, U_CKSMEdit, U_KCEdit;
{$R *.dfm}
function TfrmProductOrder_Ph.SaveEjK10(FNO, FID, fBCID, fCkNO: string): boolean;
var
fkcID: integer;
Filler: string;
FillTime: TdateTime;
begin
result := false;
try
with CDS_PH do
begin
with ADOQueryCmd do
begin
close;
sql.Clear;
sql.Add('select * from WFB_MJJY1');
sql.Add('where 1=2 ');
open;
end;
// fkcID:=strtoint(RightBStr(trim(FNO),length(FNO)-3)+trim(FID));
ADOQueryCmd.Append;
ADOQueryCmd.FieldByName('CRTime').Value := formatdateTime('yyyy-MM-dd', CRdate.Date);
// ADOQueryCmd.FieldByName('CKName').Value:='<27><EFBFBD>ֿ<EFBFBD>';
// ADOQueryCmd.FieldByName('CRType').Value:='<27><EFBFBD><E3B6AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
// ADOQueryCmd.FieldByName('CRFlag').Value:='<27><><EFBFBD><EFBFBD>';
ADOQueryCmd.FieldByName('mainID').Value := trim(fieldbyname('mainID').AsString);
ADOQueryCmd.FieldByName('subID').Value := trim(fieldbyname('subID').AsString);
ADOQueryCmd.FieldByName('MJID').Value := trim(fieldbyname('MJID').AsString);
ADOQueryCmd.FieldByName('MJXH').Value := trim(fieldbyname('MJXH').AsString);
ADOQueryCmd.FieldByName('MJTYPE').Value := trim(fieldbyname('MJType').AsString);
ADOQueryCmd.FieldByName('APID').Value := trim(fieldbyname('APID').AsString);
ADOQueryCmd.FieldByName('C_Code').Value := trim(fieldbyname('C_Code').AsString);
ADOQueryCmd.FieldByName('C_CodeName').Value := trim(fieldbyname('C_CodeName').AsString);
ADOQueryCmd.FieldByName('C_spec').Value := trim(fieldbyname('C_spec').AsString);
ADOQueryCmd.FieldByName('C_Color').Value := trim(fieldbyname('C_Color').AsString);
ADOQueryCmd.FieldByName('RCgangNO').Value := trim(fieldbyname('RCgangNO').AsString);
ADOQueryCmd.FieldByName('BCgangNO').Value := trim(fieldbyname('BCgangNO').AsString);
ADOQueryCmd.FieldByName('BCgangNO').Value := trim(fieldbyname('BCgangNO').AsString);
// ADOQueryCmd.FieldByName('P_MF').Value:=fieldbyname('P_MF').AsFloat;
// ADOQueryCmd.FieldByName('P_KZ').Value:=fieldbyname('P_KZ').AsFloat;
// ADOQueryCmd.FieldByName('RollNum').Value:=fieldbyname('RollNum').AsFloat;
ADOQueryCmd.FieldByName('MJLen').Value := fieldbyname('Qty').AsFloat;
ADOQueryCmd.FieldByName('MJQty1').Value := fieldbyname('Qty').AsFloat;
ADOQueryCmd.FieldByName('MJTypeOther').Value := trim(fieldbyname('QtyUnit').AsString);
ADOQueryCmd.FieldByName('Mjstr1').Value := trim(fieldbyname('QtyUnit').AsString);
ADOQueryCmd.FieldByName('Mjstr2').Value := <><CEB4><EFBFBD><EFBFBD>';
ADOQueryCmd.FieldByName('Mjstr3').Value := fCkNO;
// ADOQueryCmd.FieldByName('packNo').Value:=trim(fieldbyname('packNo').AsString);
ADOQueryCmd.FieldByName('note').Value := '';
ADOQueryCmd.FieldByName('Filler').Value := trim(Filler);
ADOQueryCmd.FieldByName('FillTime').Value := SGetServerDateTime(ADOQueryTemp);
// ADOQueryCmd.FieldByName('fromMainID').Value:=trim(fCkNO);
ADOQueryCmd.FieldByName('BCID').Value := trim(fBCID);
// ADOQueryCmd.FieldByName('kcID').Value:=fkcID;
ADOQueryCmd.Post;
end;
result := true;
except
end;
end;
function TfrmProductOrder_Ph.YSData_other(Order_Main10: TClientDataSet; FYFName: string; fMoney: double): Boolean;
var
CRID, YFID, Price, PriceUnit, OrderUnit, FComTaiTou, customName: string;
begin
Result := False;
with Order_Main10 do
begin
with ADOQueryTemp do
begin
Close;
SQL.Clear;
sql.Add('select * from YF_Money_KC where FactoryName=''' + Trim(Order_Main10.fieldbyname('CustomerNoName').AsString) + '''');
sql.Add(' and YFDefFlag1=0 ');
Open;
end;
if not ADOQueryTemp.IsEmpty then
begin
CRID := ADOQueryTemp.fieldbyname('CRID').AsString;
end
else
begin
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('Update YF_Money_CRID set CRID=CRID+1');
sql.Add('select * from YF_Money_CRID ');
Open;
end;
CRID := ADOQueryCmd.fieldbyname('CRID').AsString;
with ADOQueryCmd do
begin
Close;
SQL.Clear;
sql.Add('select * from YF_Money_KC where 1<>1');
Open;
end;
with ADOQueryCmd do
begin
Append;
FieldByName('CRID').Value := StrToInt(CRID);
FieldByName('FactoryName').Value := Trim(Order_Main10.fieldbyname('CustomerNoName').AsString);
FieldByName('ZdyStr1').Value := <><D3A6><EFBFBD><EFBFBD>';
Post;
end;
end;
with ADOQueryTemp do
begin
Close;
sql.Clear;
sql.add('select * from YF_Money_CR ');
sql.Add(' where MainID=''' + Trim(Order_Main10.fieldbyname('MainID').AsString) + '''');
sql.Add(' and subID=''' + Trim(Order_Main10.fieldbyname('subID').AsString) + '''');
sql.Add(' and YFName=''' + trim(FYFName) + ''' ');
Open;
end;
if ADOQueryTemp.IsEmpty then
begin
if GetLSNo(ADOQueryCmd, YFID, 'CS', 'YF_Money_CR', 4, 1) = False then
begin
Application.MessageBox(<><C8A1><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>!', '<27><>ʾ', 0);
Exit;
end;
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('select * from YF_Money_CR where 1<>1');
Open;
end;
with ADOQueryCmd do
begin
Append;
FieldByName('YFID').Value := Trim(YFID);
FieldByName('YFTypeId').Value := Trim(Order_Main10.fieldbyname('MainId').AsString);
FieldByName('CRID').Value := StrToInt(CRID);
FieldByName('Filler').Value := Trim(DName);
FieldByName('CRType').Value := <>տ<EFBFBD><D5BF>Ǽ<EFBFBD>';
FieldByName('CRFlag').Value := <><D3A6><EFBFBD><EFBFBD>';
FieldByName('QtyFlag').Value := 1;
FieldByName('FactoryName').Value := Trim(Order_Main10.fieldbyname('CustomerNoName').AsString);
FieldByName('CRTime').Value := Trim(FormatDateTime('yyyy-MM-dd', CRdate.Date));
FieldByName('YFType').Value := '<27>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD>';
FieldByName('Qty').Value := 0;
FieldByName('Price').Value := 0;
FieldByName('HuiLv').Value := 1;
FieldByName('money').Value := fMoney;
FieldByName('BBmoney').Value := fMoney;
FieldByName('BZType').Value := '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
FieldByName('QtyUnit').Value := 'M';
FieldByName('ComTaiTou').Value := Trim(Order_Main10.fieldbyname('CustomerNoName').AsString);
FieldByName('YFName').Value := trim(FYFName);
FieldByName('P_CodeName').Value := Trim(Order_Main10.fieldbyname('PRTCodeName').AsString);
FieldByName('P_Color').Value := Trim(Order_Main10.fieldbyname('PRTColor').AsString);
FieldByName('MainId').Value := Trim(Order_Main10.fieldbyname('Mainid').AsString);
FieldByName('subID').Value := Trim(Order_Main10.fieldbyname('subID').AsString);
FieldByName('SYRName').Value := Trim(Order_Main10.fieldbyname('SYRName').AsString);
FieldByName('YFDefFlag1').Value := 0;
FieldByName('status').Value := '1';
Post;
end;
end
else
begin
YFID := Trim(ADOQueryTemp.fieldbyname('YFID').AsString);
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('select * from YF_Money_CR where YFID=''' + trim(YFID) + '''');
Open;
edit;
FieldByName('CRTime').Value := Trim(FormatDateTime('yyyy-MM-dd', CRdate.Date));
post;
end;
end;
with ADOQueryCmd do
begin
Close;
sql.Clear;
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=' + CRID);
ExecSQL;
end;
end;
Result := True;
end;
procedure TfrmProductOrder_Ph.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 TfrmProductOrder_Ph.CreateTable();
var
strSQL: string;
begin
TblCprk := '[##CP_PH' + 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;
function TfrmProductOrder_Ph.SaveEjK(FNO, FID, fBCID, fCkNO: string): boolean;
var
fkcID: integer;
Filler: string;
FillTime: TdateTime;
begin
result := false;
try
with ADOQueryCmd do
begin
Close;
sql.Clear;
SQL.add('Update BP_Kcid Set kcid=kcid+1');
sql.Add('select kcid from BP_Kcid');
Open;
end;
fkcID := ADOQueryCmd.fieldbyname('kcid').AsInteger;
with CDS_PH do
begin
with ADOQueryCmd do
begin
close;
sql.Clear;
sql.Add('select * from BP_InOut');
sql.Add('where 1=2 ');
open;
end;
// fkcID:=strtoint(RightBStr(trim(FNO),length(FNO)-3)+trim(FID));
ADOQueryCmd.Append;
ADOQueryCmd.FieldByName('CRNO').Value := trim(FNO);
ADOQueryCmd.FieldByName('CRID').Value := FID;
ADOQueryCmd.FieldByName('CRTime').Value := formatdateTime('yyyy-MM-dd', CRdate.Date);
ADOQueryCmd.FieldByName('CKName').Value := '<27><>Ʒ<EFBFBD>ֿ<EFBFBD>';
ADOQueryCmd.FieldByName('CRType').Value := '<27><>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
ADOQueryCmd.FieldByName('CRFlag').Value := '<27><><EFBFBD><EFBFBD>';
ADOQueryCmd.FieldByName('mainID').Value := trim(fieldbyname('mainID').AsString);
ADOQueryCmd.FieldByName('subID').Value := trim(fieldbyname('subID').AsString);
ADOQueryCmd.FieldByName('MJID').Value := trim(fieldbyname('MJID').AsString);
ADOQueryCmd.FieldByName('MJXH').Value := trim(fieldbyname('MJXH').AsString);
ADOQueryCmd.FieldByName('CPTYPE').Value := trim(fieldbyname('MJType').AsString);
ADOQueryCmd.FieldByName('P_Code').Value := trim(fieldbyname('C_Code').AsString);
ADOQueryCmd.FieldByName('P_CodeName').Value := trim(fieldbyname('C_CodeName').AsString);
ADOQueryCmd.FieldByName('P_spec').Value := trim(fieldbyname('C_spec').AsString);
ADOQueryCmd.FieldByName('P_Color').Value := trim(fieldbyname('C_Color').AsString);
// ADOQueryCmd.FieldByName('P_MF').Value:=fieldbyname('P_MF').AsFloat;
// ADOQueryCmd.FieldByName('P_KZ').Value:=fieldbyname('P_KZ').AsFloat;
ADOQueryCmd.FieldByName('RollNum').Value := fieldbyname('RollNum').AsFloat;
ADOQueryCmd.FieldByName('Qty').Value := fieldbyname('Qty').AsFloat;
ADOQueryCmd.FieldByName('QtyUnit').Value := trim(fieldbyname('QtyUnit').AsString);
ADOQueryCmd.FieldByName('packNo').Value := trim(fieldbyname('packNo').AsString);
ADOQueryCmd.FieldByName('note').Value := '';
ADOQueryCmd.FieldByName('Filler').Value := trim(Filler);
ADOQueryCmd.FieldByName('FillTime').Value := SGetServerDateTime(ADOQueryTemp);
ADOQueryCmd.FieldByName('fromMainID').Value := trim(fCkNO);
ADOQueryCmd.FieldByName('FromSubID').Value := trim(fBCID);
ADOQueryCmd.FieldByName('kcID').Value := fkcID;
ADOQueryCmd.Post;
with ADOQueryCmd do
begin
close;
sql.Clear;
sql.Add('select * from BP_KC');
sql.Add('where 1=2 ');
open;
end;
ADOQueryCmd.Append;
ADOQueryCmd.FieldByName('kcID').Value := fkcID;
ADOQueryCmd.FieldByName('CKName').Value := '<27><>Ʒ<EFBFBD>ֿ<EFBFBD>';
ADOQueryCmd.FieldByName('CRType').Value := '<27><>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
ADOQueryCmd.FieldByName('CRNO').Value := trim(FNO);
ADOQueryCmd.FieldByName('CRID').Value := FID;
ADOQueryCmd.FieldByName('CRTime').Value := formatdateTime('yyyy-MM-dd', CRdate.Date);
ADOQueryCmd.FieldByName('CRFlag').Value := '<27><><EFBFBD><EFBFBD>';
ADOQueryCmd.FieldByName('mainID').Value := trim(fieldbyname('mainID').AsString);
ADOQueryCmd.FieldByName('subID').Value := trim(fieldbyname('subID').AsString);
ADOQueryCmd.FieldByName('MJXH').Value := trim(fieldbyname('MJXH').AsString);
ADOQueryCmd.FieldByName('MJID').Value := trim(fieldbyname('MJID').AsString);
ADOQueryCmd.FieldByName('CPType').Value := trim(fieldbyname('MJType').AsString);
ADOQueryCmd.FieldByName('P_Code').Value := trim(fieldbyname('C_Code').AsString);
ADOQueryCmd.FieldByName('P_CodeName').Value := trim(fieldbyname('C_CodeName').AsString);
ADOQueryCmd.FieldByName('P_spec').Value := trim(fieldbyname('C_spec').AsString);
ADOQueryCmd.FieldByName('P_Color').Value := trim(fieldbyname('C_Color').AsString);
// ADOQueryCmd.FieldByName('P_MF').Value:=fieldbyname('P_MF').AsFloat;
// ADOQueryCmd.FieldByName('P_KZ').Value:=fieldbyname('P_KZ').AsFloat;
ADOQueryCmd.FieldByName('RollNum').Value := fieldbyname('RollNum').AsFloat;
ADOQueryCmd.FieldByName('Qty').Value := fieldbyname('Qty').AsFloat;
ADOQueryCmd.FieldByName('QtyUnit').Value := trim(fieldbyname('QtyUnit').AsString);
ADOQueryCmd.FieldByName('kcID').Value := fkcID;
ADOQueryCmd.Post;
end;
result := true;
except
end;
end;
function TfrmProductOrder_Ph.YSData(Order_Main10: TClientDataSet): Boolean;
var
CRID, YFID, Price, PriceUnit, OrderUnit, FComTaiTou, customName: string;
begin
Result := False;
with Order_Main10 do
begin
with ADOQueryTemp do
begin
Close;
SQL.Clear;
sql.Add('select * from YF_Money_KC where FactoryName=''' + Trim(Order_Main10.fieldbyname('CustomerNoName').AsString) + '''');
sql.Add(' and YFDefFlag1=0 ');
Open;
end;
if not ADOQueryTemp.IsEmpty then
begin
CRID := ADOQueryTemp.fieldbyname('CRID').AsString;
end
else
begin
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('Update YF_Money_CRID set CRID=CRID+1');
sql.Add('select * from YF_Money_CRID ');
Open;
end;
CRID := ADOQueryCmd.fieldbyname('CRID').AsString;
with ADOQueryCmd do
begin
Close;
SQL.Clear;
sql.Add('select * from YF_Money_KC where 1<>1');
Open;
end;
with ADOQueryCmd do
begin
Append;
FieldByName('CRID').Value := StrToInt(CRID);
FieldByName('FactoryName').Value := Trim(Order_Main10.fieldbyname('CustomerNoName').AsString);
FieldByName('ZdyStr1').Value := <><D3A6><EFBFBD><EFBFBD>';
Post;
end;
end;
with ADOQueryTemp do
begin
Close;
sql.Clear;
sql.add('select * from YF_Money_CR ');
sql.Add(' where MainID=''' + Trim(Order_Main10.fieldbyname('MainID').AsString) + '''');
sql.Add(' and subID=''' + Trim(Order_Main10.fieldbyname('subID').AsString) + '''');
sql.Add(' and YFName=''<27><><EFBFBD>۽<EFBFBD><DBBD><EFBFBD>'' ');
Open;
end;
if ADOQueryTemp.IsEmpty then
begin
if GetLSNo(ADOQueryCmd, YFID, 'CS', 'YF_Money_CR', 4, 1) = False then
begin
Application.MessageBox(<><C8A1><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>!', '<27><>ʾ', 0);
Exit;
end;
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('select * from YF_Money_CR where 1<>1');
Open;
end;
with ADOQueryCmd do
begin
Append;
FieldByName('YFID').Value := Trim(YFID);
FieldByName('YFTypeId').Value := Trim(Order_Main10.fieldbyname('MainId').AsString);
FieldByName('CRID').Value := StrToInt(CRID);
FieldByName('Filler').Value := Trim(DName);
FieldByName('CRType').Value := <>տ<EFBFBD><D5BF>Ǽ<EFBFBD>';
FieldByName('CRFlag').Value := <><D3A6><EFBFBD><EFBFBD>';
FieldByName('QtyFlag').Value := 1;
FieldByName('FactoryName').Value := Trim(Order_Main10.fieldbyname('CustomerNoName').AsString);
FieldByName('CRTime').Value := Trim(FormatDateTime('yyyy-MM-dd', CRdate.Date));
FieldByName('YFType').Value := '<27>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD>';
FieldByName('Price').Value := Order_Main10.fieldbyname('PRTPrice').Value;
FieldByName('HuiLv').Value := 1;
FieldByName('BZType').Value := '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
FieldByName('QtyUnit').Value := 'M';
FieldByName('ComTaiTou').Value := Trim(Order_Main10.fieldbyname('CustomerNoName').AsString);
FieldByName('YFName').Value := '<27><><EFBFBD>۽<EFBFBD><DBBD><EFBFBD>';
FieldByName('P_CodeName').Value := Trim(Order_Main10.fieldbyname('PRTCodeName').AsString);
FieldByName('P_Color').Value := Trim(Order_Main10.fieldbyname('PRTColor').AsString);
FieldByName('MainId').Value := Trim(Order_Main10.fieldbyname('Mainid').AsString);
FieldByName('subID').Value := Trim(Order_Main10.fieldbyname('subID').AsString);
FieldByName('SYRName').Value := Trim(Order_Main10.fieldbyname('SYRName').AsString);
FieldByName('note').Value := Trim(Order_Main10.fieldbyname('Sorddefnote1').AsString);
FieldByName('YFDefFlag1').Value := 0;
FieldByName('status').Value := '1';
Post;
end;
end
else
begin
YFID := Trim(ADOQueryTemp.fieldbyname('YFID').AsString);
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('select * from YF_Money_CR where YFID=''' + trim(YFID) + '''');
Open;
edit;
FieldByName('CRTime').Value := Trim(FormatDateTime('yyyy-MM-dd', CRdate.Date));
post;
end;
end;
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('update YF_Money_CR Set Qty=(select isnull(Sum(Qty),0) from CK_BanCP_CR A ');
sql.Add(' where A.mainID=YF_Money_CR.mainID and A.subiD=YF_Money_CR.subiD and A.CRType=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' )');
sql.Add(',PS=(select isnull(count(A.MJID),0) from CK_BanCP_CR A ');
sql.Add(' where A.mainID=YF_Money_CR.mainID and A.subiD=YF_Money_CR.subiD and A.CRType=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' )');
sql.Add(' where YFID=''' + Trim(YFID) + '''');
ExecSQL;
end;
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('Update YF_Money_CR Set Money=cast(Price*Qty as decimal(18,0)),BBMoney=cast(Price*Qty*HuiLv as decimal(18,0)) ');
sql.Add('where YFID=''' + Trim(YFID) + '''');
ExecSQL;
end;
with ADOQueryCmd do
begin
Close;
sql.Clear;
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=' + CRID);
ExecSQL;
end;
end;
Result := True;
end;
function TfrmProductOrder_Ph.SaveData(): Boolean;
var
phID: string;
begin
Result := false;
ADOQueryCmd.Connection.BeginTrans;
try
with ADOQueryCmd do
begin
close;
sql.Clear;
sql.Add('delete from CK_BanCP_PH ');
sql.Add('where mainID=' + quotedstr(trim(Order_Main.fieldbyname('mainID').AsString)));
sql.Add('and subID=' + quotedstr(trim(Order_Main.fieldbyname('subID').AsString)));
execsql;
end;
with CDS_PH do
begin
DisableControls;
first;
while not eof do
begin
if fieldbyname('qty').AsFloat = 0 then
continue;
if GetLSNo(ADOQueryTemp, phID, 'PH', 'CK_BanCP_PH', 4, 1) = False then
begin
ADOQueryCmd.Connection.RollbackTrans;
Application.MessageBox(<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ', 0);
Exit;
end;
with ADOQueryCmd do
begin
close;
sql.Clear;
sql.Add('select * from CK_BanCP_PH ');
sql.Add('where mainID=' + quotedstr(trim(Order_Main.fieldbyname('mainID').AsString)));
sql.Add('and subID=' + quotedstr(trim(Order_Main.fieldbyname('subID').AsString)));
open;
end;
ADOQueryCmd.Append;
ADOQueryCmd.FieldByName('phID').Value := trim(phID);
ADOQueryCmd.FieldByName('conNo').Value := trim(fieldbyname('conNo').AsString);
ADOQueryCmd.FieldByName('MainID').Value := trim(Order_Main.fieldbyname('MainID').AsString);
ADOQueryCmd.FieldByName('SubID').Value := trim(Order_Main.fieldbyname('SubID').AsString);
ADOQueryCmd.FieldByName('PMainID').Value := trim(fieldbyname('PMainID').AsString);
ADOQueryCmd.FieldByName('PSubID').Value := trim(fieldbyname('PSubID').AsString);
ADOQueryCmd.FieldByName('mjID').Value := trim(fieldbyname('mjID').AsString);
ADOQueryCmd.FieldByName('CRID').Value := trim(fieldbyname('CRID').AsString);
ADOQueryCmd.FieldByName('qtyunit').Value := trim(fieldbyname('kcqtyunit').AsString);
ADOQueryCmd.FieldByName('qty').Value := fieldbyname('qty').AsFloat;
ADOQueryCmd.FieldByName('Rollnum').Value := fieldbyname('Rollnum').AsFloat;
ADOQueryCmd.FieldByName('Filler').Value := trim(DName);
ADOQueryCmd.FieldByName('FillTime').Value := date();
ADOQueryCmd.Post;
with ADOQueryCmd do
begin
close;
sql.Clear;
sql.Add('select * from CK_BanCP_KC ');
sql.Add('where mjid=' + quotedstr(trim(CDS_PH.fieldbyname('mjid').AsString)));
sql.Add('and CRID=' + quotedstr(trim(CDS_PH.fieldbyname('CRID').AsString)));
open;
edit;
fieldbyname('kcstatus').Value := '1';
post;
end;
next;
end;
first;
EnableControls;
with ADOQueryCmd do
begin
close;
sql.Clear;
sql.Add('select * from JYOrder_sub ');
sql.Add('where mainID=' + quotedstr(trim(Order_Main.fieldbyname('mainID').AsString)));
sql.Add('and subID=' + quotedstr(trim(Order_Main.fieldbyname('subID').AsString)));
open;
edit;
fieldbyname('substatus').Value := '2';
post;
end;
end;
ADOQueryCmd.Connection.CommitTrans;
Result := true;
except
ADOQueryCmd.Connection.RollbackTrans;
end;
end;
procedure TfrmProductOrder_Ph.Query_MJ(mjid: string);
begin
with ADOQueryTemp do
begin
close;
sql.Clear;
sql.Add('select A.*,Rollnum=A.kcRollNum,Qty=A.kcQty,B.mjxh,D.mainID,D.subID,D.C_Code,D.C_CodeName,D.C_Spec,F.conNo ');
sql.Add('from CK_BanCP_KC A ');
sql.Add('inner join WFB_MJJY B on B.mjid=A.mjid ');
sql.Add('inner join Contract_Sub D on D.MainId=B.mainID and D.SubId=b.subID ');
sql.Add('inner join Contract_main F on F.MainId=F.mainID ');
sql.Add('where A.mjID=' + quotedstr(trim(mjid)));
open;
if IsEmpty then
begin
application.MessageBox('<27>˾<EFBFBD><CBBE>Ų<EFBFBD><C5B2><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ<EFBFBD><CABE>Ϣ', MB_ICONERROR);
exit;
end
else if CDS_PH.Locate('mjid', fieldbyname('MjID').AsString, []) then
begin
application.MessageBox('<27>˾<EFBFBD><CBBE><EFBFBD><EFBFBD>Ѽ<EFBFBD><D1BC><EFBFBD>!', '<27><>ʾ<EFBFBD><CABE>Ϣ', MB_ICONERROR);
exit;
end
else
begin
CDS_PH.Append;
CDS_PH.FieldByName('conNo').Value := trim(fieldbyname('conNo').AsString);
CDS_PH.FieldByName('mjid').Value := trim(fieldbyname('mjid').AsString);
// CDS_PH.FieldByName('mjxh').Value:=trim(fieldbyname('mjxh').AsString);
CDS_PH.FieldByName('C_CodeName').Value := trim(fieldbyname('C_CodeName').AsString);
CDS_PH.FieldByName('C_Spec').Value := trim(fieldbyname('C_Spec').AsString);
CDS_PH.FieldByName('PMainID').Value := trim(fieldbyname('MainID').AsString);
CDS_PH.FieldByName('PSubID').Value := trim(fieldbyname('SubID').AsString);
CDS_PH.FieldByName('kcqtyunit').Value := trim(fieldbyname('kcqtyunit').AsString);
CDS_PH.FieldByName('kcqty').Value := fieldbyname('kcqty').AsFloat;
CDS_PH.FieldByName('kcRollnum').Value := fieldbyname('kcRollnum').AsFloat;
CDS_PH.FieldByName('Qty').Value := fieldbyname('kcqty').AsFloat;
CDS_PH.FieldByName('RollNum').Value := fieldbyname('kcRollnum').AsFloat;
CDS_PH.FieldByName('CRID').Value := fieldbyname('CRID').AsFloat;
CDS_PH.Post;
end;
end;
end;
procedure TfrmProductOrder_Ph.InitPH();
begin
if ADOQueryMain.Active = False then
Exit;
if Order_Main.IsEmpty then
EXIT;
try
ADO_PH.DisableControls;
with ADO_PH do
begin
Close;
sql.Clear;
Filtered := False;
sql.Add('select A.*,B.KCKGQty,B.KCQty,B.KCQtyUnit,B.kcRollNum,B.CPType,B.C_Code,C.kckw,B.C_CodeName,B.C_Spec,B.C_Color,B.RCGangNo,E.MJType,E.apID,B.mjxh ');
sql.Add('from CK_BanCP_PH A ');
sql.Add('INNER join CK_BanCP_KC B on B.CRID=A.CRID ');
sql.Add('LEFT join CK_BanCP_CR C on C.CRID=B.CRID and CRFlag=''<27><><EFBFBD><EFBFBD>'' ');
sql.Add('LEFT join WFB_MJJY E on A.MJID=E.MJID ');
sql.Add('where A.mainID=' + quotedstr(trim(Order_Main.fieldbyname('mainID').asstring)));
sql.Add('and A.subID=' + quotedstr(trim(Order_Main.fieldbyname('subID').asstring)));
sql.Add('order by A.phID ');
Open;
end;
SCreateCDS20(ADO_PH, CDS_PH);
SInitCDSData20(ADO_PH, CDS_PH);
finally
ADO_PH.EnableControls;
end;
end;
procedure TfrmProductOrder_Ph.FormDestroy(Sender: TObject);
begin
frmProductOrder_Ph := nil;
end;
procedure TfrmProductOrder_Ph.FormClose(Sender: TObject; var Action: TCloseAction);
begin
Action := caFree;
end;
procedure TfrmProductOrder_Ph.FormCreate(Sender: TObject);
begin
cxgrid2.Align := alClient;
// CreateTable();
//BegDate.DateTime:=SGetServerDateTime(ADOQueryTemp)-7;
//EndDate.DateTime:=SGetServerDateTime(ADOQueryTemp);
DQdate := SGetServerDate(ADOQueryTemp);
CRdate.DateTime := DQdate;
cxTabControl1.TabIndex := 0;
del.Visible := false;
phwc.Visible := false;
phok.Visible := false;
fh.Visible := false;
Panel2.Visible := false;
ToolButton4.Visible := false;
// TV2.OptionsData.Editing:=false;
ToolButton5.Visible := false;
case cxTabControl1.TabIndex of
0:
begin
del.Visible := true;
phwc.Visible := true;
Panel2.Visible := true;
ToolButton4.Visible := true;
// TV2.OptionsData.Editing:=true;
end;
1:
begin
phok.Visible := true;
ToolButton5.Visible := true;
end;
2:
begin
fh.Visible := true;
ToolButton5.Visible := true;
end;
3:
begin
end;
end;
application.ProcessMessages;
end;
procedure TfrmProductOrder_Ph.TBCloseClick(Sender: TObject);
begin
Close;
if FCloth <> 1 then
WriteCxGrid(self.Caption, Tv1, '<27><><EFBFBD><EFBFBD>ָʾ<D6B8><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>')
else
WriteCxGrid(self.Caption, Tv1, '<27><><EFBFBD><EFBFBD>ָʾ<D6B8><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
WriteCxGrid(self.Caption + tv2.name, Tv2, '<27><><EFBFBD><EFBFBD>ָʾ<D6B8><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
end;
procedure TfrmProductOrder_Ph.InitGrid();
var
strwhere: string;
begin
strwhere := '';
if cxTabControl1.TabIndex = 0 then
begin
strwhere := strwhere + ' and isnull(substatus,''0'')=''' + inttostr(cxTabControl1.TabIndex) + '''';
strwhere := strwhere + ' and isnull(OrderType,''0'')<>''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' ';
end;
if (cxTabControl1.TabIndex >= 1) and (cxTabControl1.TabIndex < 3) then
strwhere := strwhere + ' and isnull(substatus,''0'')=''' + inttostr(cxTabControl1.TabIndex + 1) + '''';
// strwhere:=strwhere+' and CustomerNoName<>''<27><EFBFBD><E3B6AB><EFBFBD>в<EFBFBD>'' ';
strwhere := strwhere + ' and B.syrName<>''<27><><EFBFBD>˷<EFBFBD>֯'' and isnull(OrderType,''0'')<>''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' ';
try
ADOQueryMain.DisableControls;
with ADOQueryMain do
begin
Filtered := False;
Close;
sql.Clear;
sql.add('exec P_View_Order ''' + FormatDateTime('yyyy-MM-dd', BegDate.DateTime) + ''',''' + FormatDateTime('yyyy-MM-dd', enddate.DateTime + 1) + ''',' + QuotedStr(strwhere) + ' ');
// Parameters.ParamByName('WSql').Value := strwhere;
// Parameters.ParamByName('begdate').Value := ;
// Parameters.ParamByName('enddate').Value := ;
// ShowMessage(SQL.text);
ExecSQL;
Open;
end;
SCreateCDS20(ADOQueryMain, Order_Main);
SInitCDSData20(ADOQueryMain, Order_Main);
TBFind.Click;
finally
ADOQueryMain.EnableControls;
end;
end;
procedure TfrmProductOrder_Ph.InitGridFH();
begin
try
ADOQueryMain.DisableControls;
with ADOQueryMain do
begin
Filtered := False;
Close;
sql.Clear;
sql.Add('exec Order_QryList :MainId,:WSql');
Parameters.ParamByName('WSql').Value := ' and FillTime>=''' + Trim(FormatDateTime('yyyy-MM-dd', BegDate.DateTime)) + '''' + ' and FillTime<''' + Trim(FormatDateTime('yyyy-MM-dd', EndDate.DateTime + 1)) + '''';
Open;
end;
SCreateCDS20(ADOQueryMain, Order_Main);
SInitCDSData20(ADOQueryMain, Order_Main);
finally
ADOQueryMain.EnableControls;
end;
end;
procedure TfrmProductOrder_Ph.InitForm();
begin
if FCloth <> 1 then
ReadCxGrid(self.Caption, Tv1, '<27><><EFBFBD><EFBFBD>ָʾ<D6B8><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>')
else
ReadCxGrid(self.Caption, Tv1, '<27><><EFBFBD><EFBFBD>ָʾ<D6B8><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
ReadCxGrid(self.Caption + tv2.name, Tv2, '<27><><EFBFBD><EFBFBD>ָʾ<D6B8><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
if FCloth = 1 then
begin
v1Column4.Visible := True;
end
else
begin
v1Column4.Visible := False;
end;
BegDate.DateTime := SGetServerDate10(ADOQueryTemp);
EndDate.DateTime := SGetServerDate10(ADOQueryTemp);
with ADOQueryTemp do
begin
Close;
sql.Clear;
sql.Add('select Top 10* from JYOrder_Main Order by FillTime desc');
Open;
end;
ComboBox1.Clear;
with ADOQueryTemp do
begin
First;
while not Eof do
begin
ComboBox1.Items.Add(Trim(ADOQueryTemp.fieldbyname('OrderNO').AsString));
Next;
end;
end;
//InitGrid();
end;
procedure TfrmProductOrder_Ph.TBFindClick(Sender: TObject);
begin
if ADOQueryMain.Active = False then
Exit;
SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
SCreateCDS20(ADOQueryMain, Order_Main);
SInitCDSData20(ADOQueryMain, Order_Main);
end;
procedure TfrmProductOrder_Ph.TBEditClick(Sender: TObject);
begin
if Order_Main.IsEmpty then
Exit;
if Trim(Order_Main.fieldbyname('Filler').AsString) <> Trim(DName) then
begin
Application.MessageBox('<27><><EFBFBD>ܲ<EFBFBD><DCB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD><CBB5><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
Exit;
end;
try
frmOrderInPut := TfrmOrderInPut.Create(Application);
with frmOrderInPut do
begin
PState := 1;
FMainId := Trim(Self.Order_Main.fieldbyname('MainId').AsString);
FOrderNo := Trim(Self.Order_Main.fieldbyname('OrderNo').AsString);
if ShowModal = 1 then
begin
end;
end;
finally
frmOrderInPut.Free;
end;
end;
procedure TfrmProductOrder_Ph.TBDelClick(Sender: TObject);
begin
if Order_Main.IsEmpty then
Exit;
if Trim(Order_Main.fieldbyname('Filler').AsString) <> Trim(DName) then
begin
Application.MessageBox('<27><><EFBFBD>ܲ<EFBFBD><DCB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD><CBB5><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
Exit;
end;
with ADOQueryTemp do
begin
Close;
sql.Clear;
SQL.Add('select * from Contract_Cloth_LL A where exists (select * from JYOrder_Sub B where B.SubId=A.OrdSubId ');
SQL.Add(' and B.MainId=''' + Trim(Order_Main.fieldbyname('MainId').AsString) + ''')');
Open;
end;
if ADOQueryTemp.IsEmpty = False then
begin
Application.MessageBox('<27>Ѳ<EFBFBD><D1B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݲ<EFBFBD><DDB2><EFBFBD>ɾ<EFBFBD><C9BE>!', '<27><>ʾ', 0);
Exit;
end;
with ADOQueryTemp do
begin
Close;
sql.Clear;
sql.Add('select * from YF_Money_CR where MainId=''' + Trim(Order_Main.fieldbyname('MainId').AsString) + '''');
Open;
end;
if ADOQueryTemp.IsEmpty = False then
begin
Application.MessageBox('<27>Ѳ<EFBFBD><D1B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݲ<EFBFBD><DDB2><EFBFBD>ɾ<EFBFBD><C9BE>!', '<27><>ʾ', 0);
Exit;
end;
{with ADOQueryTemp do
begin
Close;
sql.Clear;
sql.Add('select * from Contract_Cloth_LLMX where OrdSubId='''+Trim(Order_Main.fieldbyname('SubId').AsString)+'''');
Open;
end;
if ADOQueryTemp.IsEmpty=False then
begin
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ϲ<EFBFBD><CFB2><EFBFBD>ɾ<EFBFBD><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!','<27><>ʾ',0);
Exit;
end; }
with ADOQueryTemp do
begin
Close;
sql.Clear;
sql.Add('select * from JYOrder_Sub_AnPai where MainId=''' + Trim(Order_Main.fieldbyname('MainId').AsString) + '''');
Open;
end;
if ADOQueryTemp.IsEmpty = False then
begin
Application.MessageBox('<27>ѻزֲ<D8B2><D6B2><EFBFBD>ɾ<EFBFBD><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
Exit;
end;
if Application.MessageBox(<><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
Exit;
if DelData() then
begin
Order_Main.Delete;
end;
end;
function TfrmProductOrder_Ph.DelData(): Boolean;
begin
try
Result := false;
ADOQueryCmd.Connection.BeginTrans;
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('delete JYOrder_Main where MainId=''' + Trim(Order_Main.fieldbyname('MainId').AsString) + '''');
sql.Add('delete JYOrder_Sub where MainId=''' + Trim(Order_Main.fieldbyname('MainId').AsString) + '''');
ExecSQL;
end;
{with ADOQueryTemp do
begin
Close;
sql.Clear;
sql.Add('select * from JYOrder_Sub where MainId='''+Trim(Order_Main.fieldbyname('MainId').AsString)+'''');
Open;
if IsEmpty then
begin
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('delete JYOrder_Main where MainId='''+Trim(Order_Main.fieldbyname('MainId').AsString)+'''');
ExecSQL;
end;
end;
end;
if Trim(Order_Main.fieldbyname('SubId').AsString)='' then
begin
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('delete JYOrder_Main where MainId='''+Trim(Order_Main.fieldbyname('MainId').AsString)+'''');
ExecSQL;
end;
end; }
ADOQueryCmd.Connection.CommitTrans;
Result := True;
except
ADOQueryCmd.Connection.RollbackTrans;
Result := False;
Application.MessageBox('<27><><EFBFBD><EFBFBD>ɾ<EFBFBD><C9BE><EFBFBD><EFBFBD><ECB3A3>', '<27><>ʾ', 0);
end;
end;
procedure TfrmProductOrder_Ph.TBExportClick(Sender: TObject);
begin
if ADOQueryMain.IsEmpty then
Exit;
SelExportData(Tv1, ADOQueryMain, '<27><><EFBFBD><EFBFBD>ָʾ<D6B8><CABE><EFBFBD>б<EFBFBD>');
end;
procedure TfrmProductOrder_Ph.TBPrintClick(Sender: TObject);
var
fPrintFile: string;
Porderno, PRTCodeName, funit: string;
i, j: Integer;
begin
if Order_Main.IsEmpty then
Exit;
if Trim(DParameters1) <> '<27><>Ȩ<EFBFBD><C8A8>' then
begin
with ADOQueryTemp do
begin
Close;
sql.Clear;
sql.Add('select * from JYOrder_Main where MainId=''' + Trim(Order_Main.fieldbyname('MainId').AsString) + '''');
Open;
end;
if ADOQueryTemp.FieldByName('OrdFlag1').AsBoolean = True then
begin
Application.MessageBox('<27>Ѵ<EFBFBD>ӡ<EFBFBD><D3A1><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD><DDA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ٴδ<D9B4>ӡ!', '<27><>ʾ', 0);
Exit;
end;
end;
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\<5C><><EFBFBD><EFBFBD>ָʾ<D6B8><CABE>.rmf';
with ADOQueryPrint do
begin
Close;
sql.Clear;
sql.Add('select PRTRollNum=Cast('''' as varchar(200)),PRTOrderQty=Cast('''' as varchar(200)),PRTCodeName,PRTOrderQty2=Cast('''' as varchar(200)),PRTCodeName,PRTOrderQty3=Cast('''' as varchar(200)),PRTCodeName, ');
sql.add('PRTColor=Cast('''' as varchar(200))');
sql.Add(' from JYOrder_Sub ');
sql.Add(' where 1<>1 ');
Open;
end;
SCreateCDS20(ADOQueryPrint, CDS_Print);
SInitCDSData20(ADOQueryPrint, CDS_Print);
if CDS_Print.IsEmpty = False then
CDS_Print.Delete;
with ADOQueryPrint do
begin
Close;
sql.Clear;
sql.Add('select *,case when PRTRollNum<>0 then ''ƥ'' else OrderUnit end Unit ');
sql.Add(' from JYOrder_Sub ');
sql.Add(' where MainId=''' + Trim(Order_Main.fieldbyname('MainId').AsString) + '''');
Open;
end;
ADOQueryPrint.DisableControls;
CDS_Print.DisableControls;
with ADOQueryPrint do
begin
First;
while not Eof do
begin
if CDS_Print.IsEmpty then
begin
with CDS_Print do
begin
Append;
FieldByName('PRTCodeName').Value := ADOQueryPrint.fieldbyname('PRTCodeName').Value;
FieldByName('PRTColor').Value := ADOQueryPrint.fieldbyname('PRTColor').Value;
FieldByName('PRTRollNum').Value := Trim(IntToStr(ADOQueryPrint.fieldbyname('PRTRollNum').AsInteger));
// FieldByName('PRTOrderQty').Value:=Trim(FloatToStr(ADOQueryPrint.fieldbyname('PRTOrderQty').Value));
if trim(ADOQueryPrint.FieldByName('unit').AsString) = 'ƥ' then
FieldByName('PRTOrderQty').Value := trim(ADOQueryPrint.fieldbyname('PRTColor').AsString) + '/' + Trim(IntToStr(ADOQueryPrint.fieldbyname('PRTRollNum').AsInteger)) + trim(ADOQueryPrint.FieldByName('unit').AsString)
else
FieldByName('PRTOrderQty').Value := trim(ADOQueryPrint.fieldbyname('PRTColor').AsString) + '/' + Trim(floattoStr(ADOQueryPrint.fieldbyname('PRTOrderQty').AsFloat)) + trim(ADOQueryPrint.FieldByName('unit').AsString);
Post;
i := 1;
PRTCodeName := Trim(ADOQueryPrint.fieldbyname('PRTCodeName').AsString);
funit := Trim(ADOQueryPrint.fieldbyname('Unit').AsString);
end;
end
else
begin
if (Trim(ADOQueryPrint.fieldbyname('PRTCodeName').AsString) = PRTCodeName) and (Trim(ADOQueryPrint.fieldbyname('Unit').AsString) = funit) then
begin
if i < 3 then
begin
with CDS_Print do
begin
Edit;
FieldByName('PRTColor').Value := Trim(FieldByName('PRTColor').AsString) + ',' + Trim(ADOQueryPrint.fieldbyname('PRTColor').AsString);
FieldByName('PRTRollNum').Value := Trim(FieldByName('PRTRollNum').AsString) + ',' + Trim(IntToStr(ADOQueryPrint.fieldbyname('PRTRollNum').AsInteger));
// FieldByName('PRTOrderQty').Value:=Trim(FieldByName('PRTOrderQty').AsString)+','+Trim(FloatToStr(ADOQueryPrint.fieldbyname('PRTOrderQty').Value));
if i = 1 then
begin
if trim(ADOQueryPrint.FieldByName('unit').AsString) = 'ƥ' then
FieldByName('PRTOrderQty2').Value := trim(ADOQueryPrint.fieldbyname('PRTColor').AsString) + '/' + Trim(IntToStr(ADOQueryPrint.fieldbyname('PRTRollNum').AsInteger)) + trim(ADOQueryPrint.FieldByName('unit').AsString)
else
FieldByName('PRTOrderQty2').Value := trim(ADOQueryPrint.fieldbyname('PRTColor').AsString) + '/' + Trim(floattoStr(ADOQueryPrint.fieldbyname('PRTOrderQty').AsFloat)) + trim(ADOQueryPrint.FieldByName('unit').AsString);
end;
if i = 2 then
begin
if trim(ADOQueryPrint.FieldByName('unit').AsString) = 'ƥ' then
FieldByName('PRTOrderQty3').Value := trim(ADOQueryPrint.fieldbyname('PRTColor').AsString) + '/' + Trim(IntToStr(ADOQueryPrint.fieldbyname('PRTRollNum').AsInteger)) + trim(ADOQueryPrint.FieldByName('unit').AsString)
else
FieldByName('PRTOrderQty3').Value := trim(ADOQueryPrint.fieldbyname('PRTColor').AsString) + '/' + Trim(floattoStr(ADOQueryPrint.fieldbyname('PRTOrderQty').AsFloat)) + trim(ADOQueryPrint.FieldByName('unit').AsString);
end;
Post;
end;
i := i + 1;
end
else
begin
with CDS_Print do
begin
Append;
FieldByName('PRTCodeName').Value := ADOQueryPrint.fieldbyname('PRTCodeName').Value;
FieldByName('PRTColor').Value := ADOQueryPrint.fieldbyname('PRTColor').Value;
FieldByName('PRTRollNum').Value := Trim(IntToStr(ADOQueryPrint.fieldbyname('PRTRollNum').AsInteger));
// FieldByName('PRTOrderQty').Value:=Trim(FloatToStr(ADOQueryPrint.fieldbyname('PRTOrderQty').Value));
if trim(ADOQueryPrint.FieldByName('unit').AsString) = 'ƥ' then
FieldByName('PRTOrderQty').Value := trim(ADOQueryPrint.fieldbyname('PRTColor').AsString) + '/' + Trim(IntToStr(ADOQueryPrint.fieldbyname('PRTRollNum').AsInteger)) + trim(ADOQueryPrint.FieldByName('unit').AsString)
else
FieldByName('PRTOrderQty').Value := trim(ADOQueryPrint.fieldbyname('PRTColor').AsString) + '/' + Trim(floattoStr(ADOQueryPrint.fieldbyname('PRTOrderQty').AsFloat)) + trim(ADOQueryPrint.FieldByName('unit').AsString);
Post;
i := 1;
PRTCodeName := Trim(ADOQueryPrint.fieldbyname('PRTCodeName').AsString);
funit := Trim(ADOQueryPrint.fieldbyname('Unit').AsString);
end;
end;
end
else
begin
with CDS_Print do
begin
Append;
FieldByName('PRTCodeName').Value := ADOQueryPrint.fieldbyname('PRTCodeName').Value;
FieldByName('PRTColor').Value := ADOQueryPrint.fieldbyname('PRTColor').Value;
FieldByName('PRTRollNum').Value := Trim(IntToStr(ADOQueryPrint.fieldbyname('PRTRollNum').AsInteger));
if trim(ADOQueryPrint.FieldByName('unit').AsString) = 'ƥ' then
FieldByName('PRTOrderQty').Value := trim(ADOQueryPrint.fieldbyname('PRTColor').AsString) + '/' + Trim(IntToStr(ADOQueryPrint.fieldbyname('PRTRollNum').AsInteger)) + trim(ADOQueryPrint.FieldByName('unit').AsString)
else
FieldByName('PRTOrderQty').Value := trim(ADOQueryPrint.fieldbyname('PRTColor').AsString) + '/' + Trim(floattoStr(ADOQueryPrint.fieldbyname('PRTOrderQty').AsFloat)) + trim(ADOQueryPrint.FieldByName('unit').AsString);
Post;
i := 1;
PRTCodeName := Trim(ADOQueryPrint.fieldbyname('PRTCodeName').AsString);
funit := Trim(ADOQueryPrint.fieldbyname('Unit').AsString);
end;
end;
end;
Next;
end;
end;
ADOQueryPrint.EnableControls;
CDS_Print.EnableControls;
if FileExists(fPrintFile) then
begin
RMVariables['customerNoName'] := Trim(Order_Main.fieldbyname('customerNoName').AsString);
RMVariables['OrderNo'] := Trim(Order_Main.fieldbyname('OrderNo').AsString);
RMVariables['Note'] := Trim(Order_Main.fieldbyname('Note').AsString);
RMVariables['FHAddress'] := Trim(Order_Main.fieldbyname('FHAddress').AsString);
RMVariables['LXFS'] := Trim(Order_Main.fieldbyname('LXFS').AsString);
RMVariables['OrdDate'] := Order_Main.fieldbyname('OrdDate').Value;
RMVariables['OrdPerson1'] := Order_Main.fieldbyname('OrdPerson1').Value;
RM1.LoadFromFile(fPrintFile);
RM1.ShowReport;
end
else
begin
Application.MessageBox(PChar(<><C3BB><EFBFBD><EFBFBD>' + ExtractFilePath(Application.ExeName) + 'Report\<5C><><EFBFBD><EFBFBD>ָʾ<D6B8><CABE>.rmf'), '<27><>ʾ', 0);
end;
if Trim(DParameters1) <> '<27><>Ȩ<EFBFBD><C8A8>' then
begin
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('Update JYOrder_Main Set OrdDefDate1=getdate(),OrdPerson1=''' + Trim(DName) + ''',OrdFlag1=1');
sql.Add(' where MainId=''' + Trim(Order_Main.fieldbyname('MainId').AsString) + '''');
ExecSQL;
end;
end;
end;
procedure TfrmProductOrder_Ph.TBRafreshClick(Sender: TObject);
begin
if FFInt = 1 then
begin
InitGridFH();
end
else
begin
InitGrid();
{ with ADOQueryTemp do
begin
Close;
sql.Clear;
sql.Add('select Top 10* from JYOrder_Main Order by FillTime desc');
Open;
end;
ComboBox1.Clear;
with ADOQueryTemp do
begin
First;
while not Eof do
begin
ComboBox1.Items.Add(Trim(ADOQueryTemp.fieldbyname('OrderNO').AsString));
Next;
end;
end; }
end;
end;
procedure TfrmProductOrder_Ph.TBAddClick(Sender: TObject);
var
maxno: string;
begin
try
frmOrderInPut := TfrmOrderInPut.Create(Application);
with frmOrderInPut do
begin
PState := 0;
FMainId := '';
if ShowModal = 1 then
begin
end;
end;
finally
frmOrderInPut.Free;
end;
end;
procedure TfrmProductOrder_Ph.OrderNoChange(Sender: TObject);
begin
if ADOQueryMain.Active = False then
Exit;
SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
SCreateCDS20(ADOQueryMain, Order_Main);
SInitCDSData20(ADOQueryMain, Order_Main);
end;
procedure TfrmProductOrder_Ph.FormShow(Sender: TObject);
begin
InitForm();
end;
procedure TfrmProductOrder_Ph.Tv1CellDblClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
begin
// if ToolButton1.Visible=False then Exit;
// ToolButton1.Click;
end;
procedure TfrmProductOrder_Ph.TBTPClick(Sender: TObject);
var
FQty, FQty1, FMxQty, FPQty, FMxQtyS, FPQtyS: string;
begin
end;
procedure TfrmProductOrder_Ph.CheckBox1Click(Sender: TObject);
begin
if Order_Main.IsEmpty then
exit;
with Order_Main do
begin
DisableControls;
first;
while not eof do
begin
edit;
fieldbyname('ssel').Value := checkbox1.Checked;
post;
next;
end;
First;
EnableControls;
end;
end;
procedure TfrmProductOrder_Ph.CheckBox2Click(Sender: TObject);
begin
if CDS_PH.IsEmpty then
exit;
with CDS_PH do
begin
DisableControls;
first;
while not eof do
begin
edit;
fieldbyname('ssel').Value := checkbox2.Checked;
post;
next;
end;
First;
EnableControls;
end;
end;
procedure TfrmProductOrder_Ph.Tv1StylesGetContentStyle(Sender: TcxCustomGridTableView; ARecord: TcxCustomGridRecord; AItem: TcxCustomGridTableItem; out AStyle: TcxStyle);
var
id, id10: Integer;
begin
{try
if Tv1.GroupedItemCount=0 then
begin
Id:=Tv1.GetColumnByFieldName('DeliveryDate').Index-tv1.GroupedItemCount;
Id10:=Tv1.GetColumnByFieldName('SubStatus').Index-tv1.GroupedItemCount;
if Trim(VarToStr(ARecord.Values[id]))='' then Exit;
if Id<0 then Exit;
if ARecord.Values[id10]='<27><><EFBFBD><EFBFBD>' then exit;
if (ARecord.Values[id]-DQdate)>=4 then Exit;
if ((ARecord.Values[id]-DQdate)>=0) and ((ARecord.Values[id]-DQdate)<4) then
AStyle:=DataLink_.QHuangSe
else
if ARecord.Values[id]-DQdate<0 then
begin
AStyle:=DataLink_OrderManage.FenHongS;
end;
end else
begin
end;
except
end; }
end;
procedure TfrmProductOrder_Ph.v1DeliveryDateCustomDrawCell(Sender: TcxCustomGridTableView; ACanvas: TcxCanvas; AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
begin
{ Id:=TV1.GetColumnByFieldName('DeliveryDate').Index;//;-TV1.GroupedItemCount;
Id10:=TV1.GetColumnByFieldName('SubStatus').Index;
if Id<0 then Exit;
if AViewInfo.GridRecord.Values[Id10]='<27><><EFBFBD><EFBFBD>' then Exit;
if AViewInfo.GridRecord.Values[Id]-SGetServerDate(ADOQueryTemp)>=4 then Exit;
if ((AViewInfo.GridRecord.Values[id]-SGetServerDate10(ADOQueryTemp))>=0) and ((AViewInfo.GridRecord.Values[id]-SGetServerDate(ADOQueryTemp))<4) then
ACanvas.Brush.Color:=clYellow
else
if (AViewInfo.GridRecord.Values[id])-(SGetServerDate10(ADOQueryTemp)<0) then
begin
ACanvas.Brush.Color:=clRed;
end;
begin
ACanvas.Brush.Color:=clRed;
end else
if AViewInfo.GridRecord.Values[Id]='Purple' then
begin
ACanvas.Brush.Color:=clPurple;
end else
if AViewInfo.GridRecord.Values[Id]='Olive' then
begin
ACanvas.Brush.Color:=clOlive;
end else
if AViewInfo.GridRecord.Values[Id]='Teal' then
begin
ACanvas.Brush.Color:=clTeal;
end else
if AViewInfo.GridRecord.Values[Id]='Background' then
begin
ACanvas.Brush.Color:=clBackground;
end; }
end;
procedure TfrmProductOrder_Ph.N1Click(Sender: TObject);
var
fPrintFile: string;
Porderno: string;
begin
if Order_Main.IsEmpty then
Exit;
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\<5C><><EFBFBD><EFBFBD>ָʾ<D6B8><CABE>10.rmf';
SDofilter(ADOQueryMain, ' OrderNoM=''' + Trim(Order_Main.fieldbyname('OrderNoM').AsString) + '''');
SCreateCDS20(ADOQueryMain, Order_Main);
SInitCDSData20(ADOQueryMain, Order_Main);
Porderno := Trim(Order_Main.fieldbyname('OrderNoM').AsString);
if FileExists(fPrintFile) then
begin
//RMVariables['begindate']:=begindate.DateTime;
//RMVariables['enddate']:=enddate.DateTime;
//RMVariables['printtime']:=Now;
//RMVariables['printer']:=Trim(gUserName);
RM1.LoadFromFile(fPrintFile);
RM1.ShowReport;
end
else
begin
Application.MessageBox(PChar(<><C3BB><EFBFBD><EFBFBD>' + ExtractFilePath(Application.ExeName) + 'Report\<5C><><EFBFBD><EFBFBD>ָʾ<D6B8><CABE>10.rmf'), '<27><>ʾ', 0);
end;
SDofilter(ADOQueryMain, '');
SCreateCDS20(ADOQueryMain, Order_Main);
SInitCDSData20(ADOQueryMain, Order_Main);
Order_Main.Locate('ordernoM', Porderno, []);
end;
procedure TfrmProductOrder_Ph.N2Click(Sender: TObject);
var
fPrintFile: string;
Porderno: string;
begin
if Order_Main.IsEmpty then
Exit;
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\<5C><><EFBFBD><EFBFBD>ָʾ<D6B8><CABE>.rmf';
SDofilter(ADOQueryMain, ' OrderNoM=''' + Trim(Order_Main.fieldbyname('OrderNoM').AsString) + '''');
SCreateCDS20(ADOQueryMain, Order_Main);
SInitCDSData20(ADOQueryMain, Order_Main);
Porderno := Trim(Order_Main.fieldbyname('OrderNoM').AsString);
if FileExists(fPrintFile) then
begin
//RMVariables['begindate']:=begindate.DateTime;
//RMVariables['enddate']:=enddate.DateTime;
//RMVariables['printtime']:=Now;
//RMVariables['printer']:=Trim(gUserName);
RM1.LoadFromFile(fPrintFile);
RM1.ShowReport;
end
else
begin
Application.MessageBox(PChar(<><C3BB><EFBFBD><EFBFBD>' + ExtractFilePath(Application.ExeName) + 'Report\<5C><><EFBFBD><EFBFBD>ָʾ<D6B8><CABE>.rmf'), '<27><>ʾ', 0);
end;
SDofilter(ADOQueryMain, '');
SCreateCDS20(ADOQueryMain, Order_Main);
SInitCDSData20(ADOQueryMain, Order_Main);
Order_Main.Locate('ordernoM', Porderno, []);
end;
procedure TfrmProductOrder_Ph.ToolButton1Click(Sender: TObject);
begin
if Order_Main.IsEmpty then
Exit;
try
frmOrderInPut := TfrmOrderInPut.Create(Application);
with frmOrderInPut do
begin
PState := 1;
FMainId := Trim(Self.Order_Main.fieldbyname('MainId').AsString);
ToolBar2.Visible := False;
TBSave.Visible := False;
ScrollBox1.Enabled := False;
Tv1.OptionsSelection.CellSelect := False;
if ShowModal = 1 then
begin
end;
end;
finally
frmOrderInPut.Free;
end;
end;
procedure TfrmProductOrder_Ph.ToolButton2Click(Sender: TObject);
begin
if Order_Main.IsEmpty then
Exit;
try
frmOrderInPut := TfrmOrderInPut.Create(Application);
with frmOrderInPut do
begin
PState := 1;
CopyInt := 99;
FMainId := Trim(Self.Order_Main.fieldbyname('MainId').AsString);
if ShowModal = 1 then
begin
end;
end;
finally
frmOrderInPut.Free;
end;
end;
procedure TfrmProductOrder_Ph.ToolButton3Click(Sender: TObject);
begin
ModalResult := 1;
end;
procedure TfrmProductOrder_Ph.OrderNoKeyPress(Sender: TObject; var Key: Char);
begin
{ if Key=#13 then
begin
if Length(OrderNoM.Text)<3 then Exit;
try
ADOQueryMain.DisableControls;
with ADOQueryMain do
begin
Filtered:=False;
Close;
sql.Clear;
sql.add('exec P_View_Order :begdate,:enddate,:WSql') ;
if Trim(DParameters1)<>'<27><>Ȩ<EFBFBD><C8A8>' then
begin
Parameters.ParamByName('WSql').Value:=' and A.Filler='''+Trim(DName)+'''';
end;
begin
Parameters.ParamByName('WSql').Value:=' and orderno like '''+'%'+Trim(OrderNoM.Text)+'%'+'''';
end;
Parameters.ParamByName('begdate').Value:='1899-01-01';
Parameters.ParamByName('enddate').Value:='2050-01-01';
ExecSQL;
Open;
end;
SCreateCDS20(ADOQueryMain,Order_Main);
SInitCDSData20(ADOQueryMain,Order_Main);
finally
ADOQueryMain.EnableControls;
end;
end; }
end;
procedure TfrmProductOrder_Ph.ConNoKeyPress(Sender: TObject; var Key: Char);
begin
{ if Key=#13 then
begin
if Length(conno.Text)<3 then Exit;
try
ADOQueryMain.DisableControls;
with ADOQueryMain do
begin
Filtered:=False;
Close;
sql.Clear;
sql.add('exec P_View_Order :begdate,:enddate,:WSql') ;
if Trim(DParameters1)<>'<27><>Ȩ<EFBFBD><C8A8>' then
begin
Parameters.ParamByName('WSql').Value:=' and A.Filler='''+Trim(DName)+'''';
end;
begin
Parameters.ParamByName('WSql').Value:=' and conno like '''+'%'+Trim(conno.Text)+'%'+'''';
end;
Parameters.ParamByName('begdate').Value:='1899-01-01';
Parameters.ParamByName('enddate').Value:='2050-01-01';
ExecSQL;
Open;
end;
SCreateCDS20(ADOQueryMain,Order_Main);
SInitCDSData20(ADOQueryMain,Order_Main);
finally
ADOQueryMain.EnableControls;
end;
end; }
end;
procedure TfrmProductOrder_Ph.Edit1KeyPress(Sender: TObject; var Key: Char);
begin
if Key = #13 then
begin
Query_MJ(Edit1.Text);
end;
end;
procedure TfrmProductOrder_Ph.phwcClick(Sender: TObject);
var
phRollNum, phQty: double;
begin
if cds_ph.IsEmpty then
exit;
with CDS_PH do
begin
DisableControls;
first;
while not eof do
begin
if (trim(fieldbyname('C_CodeName').AsString) <> trim(Order_Main.FieldByName('PRTCodeName').AsString)) or (trim(fieldbyname('C_Color').AsString) <> trim(Order_Main.FieldByName('PRTColor').AsString)) then
begin
application.MessageBox('<27><>Ʒ<EFBFBD><C6B7><EFBFBD>ƻ<EFBFBD><C6BB><EFBFBD><EFBFBD><EFBFBD>ɫ<EFBFBD><C9AB>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
EnableControls;
exit;
end;
next;
end;
first;
EnableControls;
end;
phRollNum := 0;
phQty := 0;
with CDS_PH do
begin
DisableControls;
first;
while not eof do
begin
phRollNum := phRollNum + CDS_PH.fieldbyname('RollNum').AsFloat;
phQty := phQty + CDS_PH.fieldbyname('Qty').AsFloat;
next;
end;
first;
EnableControls;
end;
if (phRollNum <> Order_Main.FieldByName('PRTRollNum').AsFloat) or (phQty <> Order_Main.FieldByName('PRTOrderQty').AsFloat) then
begin
if Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>δ<EFBFBD><EFBFBD><EFB5BD><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȷ<EFBFBD><C8B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 32 + 4) <> IDYES then
Exit;
end;
if SaveData() then
begin
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>!', '<27><>ʾ<EFBFBD><CABE>Ϣ');
TBRafresh.Click;
end
else
begin
application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>!', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
end;
end;
procedure TfrmProductOrder_Ph.cxTabControl1Change(Sender: TObject);
begin
del.Visible := false;
phwc.Visible := false;
phok.Visible := false;
fh.Visible := false;
Panel2.Visible := false;
ToolButton4.Visible := false;
// TV2.OptionsData.Editing:=false;
ToolButton5.Visible := false;
TBPrint1.Visible := false;
TBPrint2.Visible := false;
ToolButton6.Visible := false;
ToolButton8.Visible := false;
Tdbchexiao.Visible := false;
case cxTabControl1.TabIndex of
0:
begin
del.Visible := true;
phwc.Visible := true;
Panel2.Visible := true;
if fDParameters1 = '<27><>Ȩ<EFBFBD><C8A8>' then
ToolButton4.Visible := true;
// TV2.OptionsData.Editing:=true;
end;
1:
begin
fh.Visible := true;
ToolButton5.Visible := true;
if fDParameters1 = '<27><>Ȩ<EFBFBD><C8A8>' then
begin
ToolButton6.Visible := true;
ToolButton8.Visible := true;
end;
Tdbchexiao.Visible := true;
end;
2:
begin
TBPrint1.Visible := true;
TBPrint2.Visible := true;
end;
end;
application.ProcessMessages;
initGrid();
end;
procedure TfrmProductOrder_Ph.phokClick(Sender: TObject);
begin
if cds_ph.IsEmpty then
exit;
try
with ADOQueryCmd do
begin
close;
sql.Clear;
sql.Add('select * from JYOrder_sub ');
sql.Add('where mainID=' + quotedstr(trim(Order_Main.fieldbyname('mainID').AsString)));
sql.Add('and subID=' + quotedstr(trim(Order_Main.fieldbyname('subID').AsString)));
open;
edit;
fieldbyname('substatus').Value := '2';
post;
end;
application.MessageBox('<27><><EFBFBD><EFBFBD>ȷ<EFBFBD>ϳɹ<CFB3><C9B9><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ');
TBRafresh.Click;
except
application.MessageBox('<27><><EFBFBD><EFBFBD>ȷ<EFBFBD><C8B7>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
end;
end;
procedure TfrmProductOrder_Ph.delClick(Sender: TObject);
begin
if cds_ph.IsEmpty then
exit;
with ADOQueryCmd do
begin
close;
sql.Clear;
sql.Add('delete from CK_BanCP_PH ');
sql.Add('where PHID=' + quotedstr(trim(cds_ph.fieldbyname('PHID').AsString)));
execsql;
end;
cds_ph.Delete;
end;
procedure TfrmProductOrder_Ph.fhClick(Sender: TObject);
var
CKOrdNo, maxno, rkNo: string;
i, fRoll: integer;
fNum: double;
begin
if cds_ph.IsEmpty then
exit;
if Order_Main.Locate('ssel', true, []) = false then
begin
Application.MessageBox(<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
Exit;
end;
if Application.MessageBox(<><C8B7>Ҫ<EFBFBD><D2AA>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
Exit;
{ fRoll:=0;
fNum:=0;
with Order_Main do
begin
First;
DisableControls;
while not eof do
begin
if FieldByName('ssel').AsBoolean then
begin
fRoll:=fRoll+ Fieldbyname('PH_RollNum').AsInteger;
fNum:=fNum+ Fieldbyname('PH_Qty').AsFloat;
end;
next;
end;
First;
EnableControls
end;
IF fRoll<>strtointdef(trim(froll1.Text),0) then
begin
application.MessageBox('<27><><EFBFBD><EFBFBD>ƥ<EFBFBD><C6A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȷ<EFBFBD><C8B7><EFBFBD><EFBFBD><EFBFBD>ܷ<EFBFBD><DCB7><EFBFBD><EFBFBD><EFBFBD>','<27><>ʾ<EFBFBD><CABE>Ϣ',0);
exit;
end;
IF fnum<>strtofloatdef(trim(fnum1.Text),0) then
begin
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȷ<EFBFBD><C8B7><EFBFBD><EFBFBD><EFBFBD>ܷ<EFBFBD><DCB7><EFBFBD><EFBFBD><EFBFBD>','<27><>ʾ<EFBFBD><CABE>Ϣ',0);
exit;
end; }
ADOQueryCmd.Connection.BeginTrans;
try
Order_Main.First;
Order_Main.DisableControls;
CDS_ph.DisableControls;
while not Order_Main.eof do
begin
if Order_Main.FieldByName('ssel').AsBoolean then
begin
initPH();
if GetLSNo(ADOQueryCmd, CKOrdNo, 'CK', 'CK_BanCP_CR', 3, 1) = False then
begin
Application.MessageBox(<><C8A1><EFBFBD><EFBFBD><E2B5A5>ʧ<EFBFBD><CAA7>!', '<27><>ʾ', 0);
Exit;
end;
if Order_Main.FieldByName('customerNoName').AsString = '<27><>Ʒ<EFBFBD><C6B7>' then
begin
if GetLSNo(ADOQueryCmd, rkNo, 'RK', 'BP_InOut', 3, 1) = False then
begin
ADOQueryCmd.Connection.RollbackTrans;
Application.MessageBox(<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>!', '<27><>ʾ', 0);
Exit;
end;
end;
i := 1;
with CDS_ph do
begin
First;
while not eof do
begin
with ADOQueryTemp do
begin
close;
sql.Clear;
sql.Add('select P_Status from CK_BanCp_PH where PHID=' + quotedstr(trim(CDS_ph.fieldbyname('PHID').AsString)));
sql.Add('and isnull(P_Status,''0'')>=''1''');
open;
if not IsEmpty then
begin
Order_Main.EnableControls;
CDS_ph.EnableControls;
ADOQueryCmd.Connection.RollbackTrans;
Application.MessageBox('<27>˵<EFBFBD><CBB5>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˢ<EFBFBD><CBA2><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD>', '<27><>ʾ', 0);
Exit;
end;
end;
if GetLSNo(ADOQueryCmd, maxno, 'CC', 'CK_BanCp_CR', 4, 1) = False then
begin
ADOQueryCmd.Connection.RollbackTrans;
Application.MessageBox(<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ', 0);
Exit;
end;
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('select * from CK_BanCp_CR where 1<>1');
Open;
end;
with ADOQueryCmd do
begin
Append;
FieldByName('BCID').Value := Trim(maxno);
FieldByName('CRID').Value := CDS_ph.fieldbyname('CRID').Value;
FieldByName('CRTime').Value := FormatDateTime('yyyy-MM-dd', CRdate.DateTime);
FieldByName('KGQty').Value := CDS_ph.fieldbyname('KGQty').AsFloat;
FieldByName('Qty').Value := CDS_ph.fieldbyname('Qty').AsFloat;
FieldByName('RollNum').Value := CDS_ph.fieldbyname('RollNum').AsFloat;
FieldByName('QtyUnit').Value := CDS_ph.fieldbyname('QtyUnit').Value;
FieldByName('MJID').Value := CDS_ph.fieldbyname('MJID').Value;
FieldByName('MainID').Value := CDS_ph.fieldbyname('MainID').Value;
FieldByName('SubID').Value := CDS_ph.fieldbyname('SubID').Value;
FieldByName('APID').Value := CDS_ph.fieldbyname('apid').Value;
FieldByName('MJID').Value := CDS_ph.fieldbyname('MJID').Value;
FieldByName('MJxh').Value := CDS_ph.fieldbyname('MJxh').Value;
FieldByName('CPType').Value := CDS_ph.fieldbyname('MJType').Value;
FieldByName('kckw').Value := CDS_ph.fieldbyname('kckw').Value;
FieldByName('C_Code').Value := trim(CDS_ph.fieldbyname('C_Code').AsString);
FieldByName('C_CodeName').Value := trim(CDS_ph.fieldbyname('C_CodeName').AsString);
FieldByName('C_spec').Value := trim(CDS_ph.fieldbyname('C_spec').AsString);
FieldByName('C_Color').Value := trim(CDS_ph.fieldbyname('C_Color').AsString);
FieldByName('BCGangNO').Value := trim(CDS_ph.fieldbyname('BCGangNO').AsString);
FieldByName('RCGangNO').Value := trim(CDS_ph.fieldbyname('RCGangNO').AsString);
FieldByName('packNo').Value := trim(CDS_ph.fieldbyname('packNo').AsString);
FieldByName('PHID').Value := trim(CDS_ph.fieldbyname('PHID').AsString);
FieldByName('Filler').Value := Trim(DName);
FieldByName('CRFlag').Value := '<27><><EFBFBD><EFBFBD>';
FieldByName('CRType').Value := '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
FieldByName('CPType').Value := trim(CDS_ph.fieldbyname('CPType').AsString);
FieldByName('CKOrdNo').Value := Trim(CKOrdNo);
Post;
end;
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('select * from CK_BanCp_PH where PHID=' + quotedstr(trim(CDS_ph.fieldbyname('PHID').AsString)));
open;
edit;
fieldbyname('P_Status').Value := '1';
post;
end;
{ if Order_Main.FieldByName('customerNoName').AsString='<27><><EFBFBD><EFBFBD>' then
begin
if not SaveEjK10('','',maxno,CKOrdNo) then
begin
ADOQueryCmd.Connection.RollbackTrans;
exit;
end;
end;
if Order_Main.FieldByName('customerNoName').AsString='<27><>Ʒ<EFBFBD><C6B7>' then
begin
if not SaveEjK(rkNo,inttostr(i),maxno,CKOrdNo) then
begin
ADOQueryCmd.Connection.RollbackTrans;
exit;
end;
end;
if Order_Main.FieldByName('customerNoName').AsString='<27><EFBFBD><E3B6AB><EFBFBD>в<EFBFBD>' then
begin
if not SaveEjK(rkNo,inttostr(i),maxno,CKOrdNo) then
begin
ADOQueryCmd.Connection.RollbackTrans;
exit;
end;
end; }
i := i + 1;
next;
end;
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('UPDATE CK_BanCp_KC SET kcstatus=null,KCKgQty =A.KCKgQty -B.KgQty,KCQty =A.KCQty -B.Qty,KCRollNum =A.KCRollNum -B.RollNum ');
sql.Add('FROM CK_BanCp_KC A ');
sql.Add('INNER JOIN CK_BanCP_CR B on B.CRID=A.CRID ');
sql.Add('WHERE B.CKOrdNo =' + Quotedstr(trim(CKOrdNo)));
ExecSQL;
end;
with ADOQueryCmd do
begin
close;
sql.Clear;
sql.Add('select * from JYOrder_sub ');
sql.Add('where mainID=' + quotedstr(trim(Order_Main.fieldbyname('mainID').AsString)));
sql.Add('and subID=' + quotedstr(trim(Order_Main.fieldbyname('subID').AsString)));
open;
edit;
fieldbyname('substatus').Value := '3';
post;
end;
end;
if not YSData(Order_Main) then
begin
ADOQueryCmd.Connection.RollbackTrans;
application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ');
exit;
end;
if Order_Main.FieldByName('GangFee').AsFloat > 0 then
begin
if not YSData_other(Order_Main, '<27><><EFBFBD>׷<EFBFBD>', Order_Main.FieldByName('GangFee').AsFloat) then
begin
ADOQueryCmd.Connection.RollbackTrans;
application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ');
exit;
end;
end;
if Order_Main.FieldByName('YunFee').AsFloat > 0 then
begin
if not YSData_other(Order_Main, '<27>˷<EFBFBD>', Order_Main.FieldByName('YunFee').AsFloat) then
begin
ADOQueryCmd.Connection.RollbackTrans;
application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ');
exit;
end;
end;
if Order_Main.FieldByName('OtherFee').AsFloat > 0 then
begin
if not YSData_other(Order_Main, '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', Order_Main.FieldByName('OtherFee').AsFloat) then
begin
ADOQueryCmd.Connection.RollbackTrans;
application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ');
exit;
end;
end;
end;
Order_Main.Next;
end;
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('UPDATE CK_BanCp_KC SET KCRollNum =1 ');
sql.Add('WHERE (KCQty<>0 or KCKgQty<>0)and KcRollNum=0 ');
ExecSQL;
end;
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add(' update CK_BanCP_KC SET KCQty=0,kcRollNum=0 where KCQty>0 and ');
sql.Add(' exists(select X.MJID from CK_BanCP_CR X where X.MJID=CK_BanCP_KC.MJID and X.CRFlag=''<27><><EFBFBD><EFBFBD>'') ');
ExecSQL;
end;
CDS_ph.EnableControls;
Order_Main.EnableControls;
ADOQueryCmd.Connection.CommitTrans;
if Application.MessageBox(<><C8B7>Ҫ<EFBFBD><D2AA>ӡ<EFBFBD><D3A1><EFBFBD><EFBFBD><E2B5A5><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) = IDYES then
begin
TBPrint1.Click;
end;
TBRafresh.Click;
CRdate.DateTime := DQdate;
except
CDS_ph.EnableControls;
Order_Main.EnableControls;
ADOQueryCmd.Connection.RollbackTrans;
application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ');
end;
end;
procedure TfrmProductOrder_Ph.ToolButton4Click(Sender: TObject);
begin
if Order_Main.IsEmpty then
exit;
frmCKProductBCPKCListsel := TfrmCKProductBCPKCListsel.create(self);
with frmCKProductBCPKCListsel do
begin
{ if Trim(DParameters1)<>'<27><>Ȩ<EFBFBD><C8A8>' then
begin
v2RollNum.Visible:=false;
v2RollNum.Options.Editing:=false;
v2RollNum.Hidden:=true;
v2Qty.Visible:=false;
v2Qty.Options.Editing:=false;
v2Qty.Hidden:=true;
end; }
v2RollNum.Visible := false;
v2RollNum.Options.Editing := false;
v2RollNum.Hidden := true;
v2Qty.Visible := false;
v2Qty.Options.Editing := false;
v2Qty.Hidden := true;
fmainID := trim(self.Order_Main.FieldByName('mainID').AsString);
// C_CodeName.Text:= trim(self.Order_Main.FieldByName('PRTCodeName').AsString);
// C_Color.Text:= trim(self.Order_Main.FieldByName('PRTColor').AsString);
// FCodeName:= trim(self.Order_Main.FieldByName('PRTCodeName').AsString);
// fColor:= trim(self.Order_Main.FieldByName('PRTColor').AsString);
if showmodal = 1 then
begin
{CDS_PH.DisableControls;
CDS_Main.DisableControls;
CDS_Main.first;
while not CDS_Main.eof do
begin
if (CDS_Main.FieldByName('ssel').AsBoolean) and
(not CDS_PH.Locate('mjid',trim(CDS_Main.fieldbyname('mjid').AsString),[])) then
begin
CDS_PH.Append;
CDS_PH.FieldByName('conNo').Value:=trim(CDS_Main.fieldbyname('conNo').AsString);
CDS_PH.FieldByName('mjid').Value:=trim(CDS_Main.fieldbyname('mjid').AsString);
// CDS_PH.FieldByName('mjxh').Value:=trim(fieldbyname('mjxh').AsString);
CDS_PH.FieldByName('C_CodeName').Value:=trim(CDS_Main.fieldbyname('C_CodeName').AsString);
CDS_PH.FieldByName('C_Spec').Value:=trim(CDS_Main.fieldbyname('C_Spec').AsString);
CDS_PH.FieldByName('C_Color').Value:=trim(CDS_Main.fieldbyname('C_Color').AsString);
CDS_PH.FieldByName('PMainID').Value:=trim(CDS_Main.fieldbyname('MainID').AsString);
CDS_PH.FieldByName('PSubID').Value:=trim(CDS_Main.fieldbyname('SubID').AsString);
CDS_PH.FieldByName('kcqtyunit').Value:=trim(CDS_Main.fieldbyname('kcqtyunit').AsString);
CDS_PH.FieldByName('kcqty').Value:=CDS_Main.fieldbyname('kcqty').AsFloat;
CDS_PH.FieldByName('kcRollnum').Value:=CDS_Main.fieldbyname('kcRollnum').AsFloat;
CDS_PH.FieldByName('Qty').Value:=CDS_Main.fieldbyname('kcqty').AsFloat;
CDS_PH.FieldByName('RollNum').Value:=CDS_Main.fieldbyname('kcRollnum').AsFloat;
CDS_PH.FieldByName('CRID').Value:=CDS_Main.fieldbyname('CRID').AsFloat;
CDS_PH.Post;
end;
CDS_Main.next;
end;
CDS_PH.EnableControls;
CDS_Main.EnableControls }
CDS_PH.DisableControls;
CDS_SubSel.DisableControls;
CDS_SubSel.first;
while not CDS_SubSel.eof do
begin
if (not CDS_PH.Locate('CRID', trim(CDS_SubSel.fieldbyname('CRID').AsString), [])) then
begin
CDS_PH.Append;
CDS_PH.FieldByName('conNo').Value := trim(CDS_SubSel.fieldbyname('conNo').AsString);
CDS_PH.FieldByName('mjid').Value := trim(CDS_SubSel.fieldbyname('mjid').AsString);
// CDS_PH.FieldByName('mjxh').Value:=trim(fieldbyname('mjxh').AsString);
CDS_PH.FieldByName('C_CodeName').Value := trim(CDS_SubSel.fieldbyname('C_CodeName').AsString);
CDS_PH.FieldByName('C_Spec').Value := trim(CDS_SubSel.fieldbyname('C_Spec').AsString);
CDS_PH.FieldByName('C_Color').Value := trim(CDS_SubSel.fieldbyname('C_Color').AsString);
CDS_PH.FieldByName('PMainID').Value := trim(CDS_SubSel.fieldbyname('MainID').AsString);
CDS_PH.FieldByName('PSubID').Value := trim(CDS_SubSel.fieldbyname('SubID').AsString);
CDS_PH.FieldByName('kcqtyunit').Value := trim(CDS_SubSel.fieldbyname('kcqtyunit').AsString);
CDS_PH.FieldByName('kcqty').Value := CDS_SubSel.fieldbyname('kcqty').AsFloat;
CDS_PH.FieldByName('kcRollnum').Value := CDS_SubSel.fieldbyname('kcRollnum').AsFloat;
CDS_PH.FieldByName('Qty').Value := CDS_SubSel.fieldbyname('kcqty').AsFloat;
CDS_PH.FieldByName('RollNum').Value := CDS_SubSel.fieldbyname('kcRollnum').AsFloat;
CDS_PH.FieldByName('CRID').Value := CDS_SubSel.fieldbyname('CRID').AsFloat;
CDS_PH.Post;
end;
CDS_SubSel.next;
end;
CDS_PH.EnableControls;
CDS_SubSel.EnableControls;
end;
free;
end;
TBRafresh.Click;
end;
procedure TfrmProductOrder_Ph.ToolButton5Click(Sender: TObject);
begin
if cds_ph.IsEmpty then
exit;
if cxTabControl1.TabIndex = 1 then
begin
if Application.MessageBox(<><C8B7>Ҫִ<D2AA>в<EFBFBD><D0B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
Exit;
try
with ADOQueryTemp do
begin
Close;
sql.Clear;
sql.Add('select * from YF_Money_CR ');
sql.Add(' where MainID=''' + Trim(Order_Main.fieldbyname('MainID').AsString) + '''');
sql.Add(' and subID=''' + Trim(Order_Main.fieldbyname('subID').AsString) + '''');
sql.Add(' and YFName=''<27><><EFBFBD>۽<EFBFBD><DBBD><EFBFBD>'' ');
sql.Add(' and status>=''1'' ');
Open;
if not ADOQueryTemp.IsEmpty then
begin
Application.MessageBox(<>տ<EFBFBD>û<EFBFBD>г<EFBFBD><D0B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˣ<EFBFBD><CBA3><EFBFBD><EFBFBD>ܳ<EFBFBD><DCB3><EFBFBD>!', '<27><>ʾ', 0);
exit;
end;
end;
with ADOQueryCmd do
begin
close;
sql.Clear;
sql.Add('select * from JYOrder_sub ');
sql.Add('where mainID=' + quotedstr(trim(Order_Main.fieldbyname('mainID').AsString)));
sql.Add('and subID=' + quotedstr(trim(Order_Main.fieldbyname('subID').AsString)));
open;
edit;
fieldbyname('substatus').Value := '0';
post;
end;
with ADOQueryCmd do
begin
close;
sql.Clear;
sql.Add('update CK_BanCP_KC SET kcstatus=null ');
sql.Add('from CK_BanCP_KC A ');
sql.Add('inner join CK_BanCP_PH B on B.CRID=A.CRID ');
sql.Add('where B.mainID=' + quotedstr(trim(Order_Main.fieldbyname('mainID').AsString)));
sql.Add('and B.subID=' + quotedstr(trim(Order_Main.fieldbyname('subID').AsString)));
execsql;
end;
with ADOQueryCmd do
begin
close;
sql.Clear;
sql.Add('delete from CK_BanCP_PH ');
sql.Add('where mainID=' + quotedstr(trim(Order_Main.fieldbyname('mainID').AsString)));
sql.Add('and subID=' + quotedstr(trim(Order_Main.fieldbyname('subID').AsString)));
execsql;
end;
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ');
TBRafresh.Click;
except
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
end;
end;
{ if cxTabControl1.TabIndex=1 then
begin
try
with ADOQueryCmd do
begin
close;
sql.Clear;
sql.Add('select * from JYOrder_sub ');
sql.Add('where mainID='+quotedstr(trim(Order_Main.fieldbyname('mainID').AsString)));
sql.Add('and subID='+quotedstr(trim(Order_Main.fieldbyname('subID').AsString)));
open;
edit;
fieldbyname('substatus').Value:='0';
post;
end;
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȷ<EFBFBD>ϳɹ<CFB3><C9B9><EFBFBD>','<27><>ʾ<EFBFBD><CABE>Ϣ');
TBRafresh.Click;
except
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȷ<EFBFBD><C8B7>ʧ<EFBFBD>ܣ<EFBFBD>','<27><>ʾ<EFBFBD><CABE>Ϣ',0);
end;
end; }
end;
procedure TfrmProductOrder_Ph.TBPrint1Click(Sender: TObject);
var
filepath, fOrderNo: string;
i: integer;
Txt, fImagePath: string;
Moudle: THandle;
Makebar: TMakebar;
Mixtext: TMixtext;
begin
if Order_Main.IsEmpty then
exit;
if Order_Main.Locate('ssel', true, []) = false then
begin
Application.MessageBox(<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
Exit;
end;
createTable();
i := 0;
with Order_Main do
begin
DisableControls;
first;
while not eof do
begin
if Fieldbyname('ssel').AsBoolean then
begin
if i = 0 then
fOrderNo := trim(fieldbyname('OrderNo').AsString);
if (i > 0) and (trim(fieldbyname('OrderNo').AsString) <> fOrderNo) then
begin
application.MessageBox('ѡ<><D1A1><EFBFBD>˲<EFBFBD>ͬ<EFBFBD>Ķ<EFBFBD><C4B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܴ<EFBFBD>ӡ<EFBFBD><D3A1>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
EnableControls;
exit;
end;
with adoqueryCmd do
begin
Close;
SQL.Clear;
SQL.Add(' insert into ' + TblCprk + '(MainID,subID) values( ');
SQL.Add(' ' + quotedstr(trim(Order_Main.fieldbyname('mainID').AsString)));
SQL.Add(',' + quotedstr(trim(Order_Main.fieldbyname('subID').AsString)));
sql.add(')');
sql.Add('Update JYOrder_Main Set OrdFlag2=1');
sql.Add(' where MainId=''' + Trim(Order_Main.fieldbyname('MainId').AsString) + '''');
execsql;
end;
i := i + 1;
end;
next;
end;
First;
EnableControls;
end;
with AdoPrint do
begin
close;
sql.Clear;
sql.Add('exec P_Do_PrintMd10 ');
sql.Add('@mainID=' + quotedstr(trim(Order_Main.fieldbyname('MainID').AsString)));
sql.Add(',@TblCprk=' + quotedstr(trim(TblCprk)));
sql.Add(',@flag=' + quotedstr(trim('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>')));
open;
end;
try
filepath := ExtractFilePath(Application.ExeName) + 'report\<5C><><EFBFBD><EFBFBD><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;
try
Moudle := LoadLibrary('MakeQRBarcode.dll');
@Makebar := GetProcAddress(Moudle, 'Make');
@Mixtext := GetProcAddress(Moudle, 'MixText');
Txt := Trim(AdoPrint.fieldbyname('orderNo').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);
exit;
end;
RMVariables['QRBARCODE'] := fImagePath;
RMVariables['dtxz'] := FormatDateTime('yyyy-mm-dd', date());
RMVariables['zdr'] := trim(DName);
RMVariables['Filler'] := trim(Order_Main.fieldbyname('Filler').AsString);
RMGridReport1.LoadFromFile(filepath);
// RMGridReport1.ShowReport;
RMGridReport1.PrintReport;
finally
DropTable();
end;
end;
procedure TfrmProductOrder_Ph.ToolButton6Click(Sender: TObject);
begin
if Order_Main.IsEmpty then
exit;
frmCKProductBCPKCListsel := TfrmCKProductBCPKCListsel.create(self);
with frmCKProductBCPKCListsel do
begin
fmainID := trim(self.Order_Main.FieldByName('mainID').AsString);
// C_CodeName.Text:= trim(self.Order_Main.FieldByName('PRTCodeName').AsString);
// C_Color.Text:= trim(self.Order_Main.FieldByName('PRTColor').AsString);
// FCodeName:= trim(self.Order_Main.FieldByName('PRTCodeName').AsString);
// fColor:= trim(self.Order_Main.FieldByName('PRTColor').AsString);
if showmodal = 1 then
begin
{CDS_PH.DisableControls;
CDS_Main.DisableControls;
CDS_Main.first;
while not CDS_Main.eof do
begin
if (CDS_Main.FieldByName('ssel').AsBoolean) and
(not CDS_PH.Locate('mjid',trim(CDS_Main.fieldbyname('mjid').AsString),[])) then
begin
CDS_PH.Append;
CDS_PH.FieldByName('conNo').Value:=trim(CDS_Main.fieldbyname('conNo').AsString);
CDS_PH.FieldByName('mjid').Value:=trim(CDS_Main.fieldbyname('mjid').AsString);
// CDS_PH.FieldByName('mjxh').Value:=trim(fieldbyname('mjxh').AsString);
CDS_PH.FieldByName('C_CodeName').Value:=trim(CDS_Main.fieldbyname('C_CodeName').AsString);
CDS_PH.FieldByName('C_Spec').Value:=trim(CDS_Main.fieldbyname('C_Spec').AsString);
CDS_PH.FieldByName('C_Color').Value:=trim(CDS_Main.fieldbyname('C_Color').AsString);
CDS_PH.FieldByName('PMainID').Value:=trim(CDS_Main.fieldbyname('MainID').AsString);
CDS_PH.FieldByName('PSubID').Value:=trim(CDS_Main.fieldbyname('SubID').AsString);
CDS_PH.FieldByName('kcqtyunit').Value:=trim(CDS_Main.fieldbyname('kcqtyunit').AsString);
CDS_PH.FieldByName('kcqty').Value:=CDS_Main.fieldbyname('kcqty').AsFloat;
CDS_PH.FieldByName('kcRollnum').Value:=CDS_Main.fieldbyname('kcRollnum').AsFloat;
CDS_PH.FieldByName('Qty').Value:=CDS_Main.fieldbyname('kcqty').AsFloat;
CDS_PH.FieldByName('RollNum').Value:=CDS_Main.fieldbyname('kcRollnum').AsFloat;
CDS_PH.FieldByName('CRID').Value:=CDS_Main.fieldbyname('CRID').AsFloat;
CDS_PH.Post;
end;
CDS_Main.next;
end;
CDS_PH.EnableControls;
CDS_Main.EnableControls }
CDS_PH.DisableControls;
CDS_SubSel.DisableControls;
CDS_SubSel.first;
while not CDS_SubSel.eof do
begin
if (not CDS_PH.Locate('CRID', trim(CDS_SubSel.fieldbyname('CRID').AsString), [])) then
begin
CDS_PH.Append;
CDS_PH.FieldByName('conNo').Value := trim(CDS_SubSel.fieldbyname('conNo').AsString);
CDS_PH.FieldByName('mjid').Value := trim(CDS_SubSel.fieldbyname('mjid').AsString);
// CDS_PH.FieldByName('mjxh').Value:=trim(fieldbyname('mjxh').AsString);
CDS_PH.FieldByName('C_CodeName').Value := trim(CDS_SubSel.fieldbyname('C_CodeName').AsString);
CDS_PH.FieldByName('C_Spec').Value := trim(CDS_SubSel.fieldbyname('C_Spec').AsString);
CDS_PH.FieldByName('C_Color').Value := trim(CDS_SubSel.fieldbyname('C_Color').AsString);
CDS_PH.FieldByName('PMainID').Value := trim(CDS_SubSel.fieldbyname('MainID').AsString);
CDS_PH.FieldByName('PSubID').Value := trim(CDS_SubSel.fieldbyname('SubID').AsString);
CDS_PH.FieldByName('kcqtyunit').Value := trim(CDS_SubSel.fieldbyname('kcqtyunit').AsString);
CDS_PH.FieldByName('kcqty').Value := CDS_SubSel.fieldbyname('kcqty').AsFloat;
CDS_PH.FieldByName('kcRollnum').Value := CDS_SubSel.fieldbyname('kcRollnum').AsFloat;
CDS_PH.FieldByName('Qty').Value := CDS_SubSel.fieldbyname('kcqty').AsFloat;
CDS_PH.FieldByName('RollNum').Value := CDS_SubSel.fieldbyname('kcRollnum').AsFloat;
CDS_PH.FieldByName('CRID').Value := CDS_SubSel.fieldbyname('CRID').AsFloat;
CDS_PH.Post;
end;
CDS_SubSel.next;
end;
CDS_PH.EnableControls;
CDS_SubSel.EnableControls;
end;
free;
end;
TBRafresh.Click;
end;
procedure TfrmProductOrder_Ph.Tv1FocusedRecordChanged(Sender: TcxCustomGridTableView; APrevFocusedRecord, AFocusedRecord: TcxCustomGridRecord; ANewItemRecordFocusingChanged: Boolean);
begin
if Order_Main.IsEmpty then
exit;
initPH();
end;
procedure TfrmProductOrder_Ph.TBPrint2Click(Sender: TObject);
var
filepath, fOrderNo: string;
i: integer;
begin
if Order_Main.IsEmpty then
exit;
if Order_Main.Locate('ssel', true, []) = false then
begin
Application.MessageBox(<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
Exit;
end;
createTable();
i := 0;
with Order_Main do
begin
DisableControls;
first;
while not eof do
begin
if Fieldbyname('ssel').AsBoolean then
begin
if i = 0 then
fOrderNo := trim(fieldbyname('OrderNo').AsString);
if (i > 0) and (trim(fieldbyname('OrderNo').AsString) <> fOrderNo) then
begin
application.MessageBox('ѡ<><D1A1><EFBFBD>˲<EFBFBD>ͬ<EFBFBD>Ķ<EFBFBD><C4B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܴ<EFBFBD>ӡ<EFBFBD><D3A1>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
EnableControls;
exit;
end;
with adoqueryCmd do
begin
Close;
SQL.Clear;
SQL.Add(' insert into ' + TblCprk + '(MainID,subID) values( ');
SQL.Add(' ' + quotedstr(trim(Order_Main.fieldbyname('mainID').AsString)));
SQL.Add(',' + quotedstr(trim(Order_Main.fieldbyname('subID').AsString)));
sql.add(')');
execsql;
end;
i := i + 1;
end;
next;
end;
First;
EnableControls;
end;
with AdoPrint do
begin
close;
sql.Clear;
sql.Add('exec P_Do_PrintMd10 ');
sql.Add('@mainID=' + quotedstr(trim(Order_Main.fieldbyname('MainID').AsString)));
sql.Add(',@TblCprk=' + quotedstr(trim(TblCprk)));
sql.Add(',@flag=' + quotedstr(trim('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>')));
open;
end;
try
filepath := ExtractFilePath(Application.ExeName) + 'report\<5C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EBB5A5>ֽ<EFBFBD><D6BD>.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['dtxz'] := FormatDateTime('yyyy-mm-dd', date());
RMVariables['zdr'] := trim(DName);
RMVariables['Filler'] := trim(Order_Main.fieldbyname('Filler').AsString);
RMGridReport1.LoadFromFile(filepath);
RMGridReport1.ShowReport;
finally
DropTable();
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('Update JYOrder_Main Set OrdFlag2=1');
sql.Add(' where MainId=''' + Trim(Order_Main.fieldbyname('MainId').AsString) + '''');
ExecSQL;
end;
end;
end;
procedure TfrmProductOrder_Ph.ToolButton7Click(Sender: TObject);
begin
try
frmCKSMEdit := TfrmCKSMEdit.Create(Application);
with frmCKSMEdit do
begin
FphRollNum := Order_Main.fieldbyName('PRTRollNum').AsFloat;
FphQty := Order_Main.FieldByName('PRTOrderQty').AsFloat;
FOrderType := Order_Main.fieldbyName('OrderType').asstring;
show;
end;
finally
end;
end;
procedure TfrmProductOrder_Ph.ToolButton8Click(Sender: TObject);
var
kcQty, num1: double;
i: integer;
isEdit: boolean;
begin
if not CDS_PH.Active then
exit;
{ if CDS_PH.Locate('SSel',True,[])=False then
begin
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!','<27><>ʾ',0);
Exit;
end;
}
isEdit := false;
frmKCEdit := TfrmKCEdit.create(self);
with frmKCEdit do
begin
if showmodal = 1 then
begin
num1 := strtofloatdef(cxCurrencyEdit2.Text, 0);
i := RadioGroup1.ItemIndex;
isEdit := true;
end;
free;
end;
if isEdit = false then
exit;
CDS_PH.first;
try
ADOQueryCmd.Connection.BeginTrans;
with CDS_PH do
begin
while CDS_PH.Locate('SSel', True, []) do
begin
if i = 0 then
kcQty := CDS_PH.fieldbyname('Qty').AsFloat + num1;
if i = 1 then
kcQty := CDS_PH.fieldbyname('Qty').AsFloat - num1;
if i = 2 then
kcQty := strtofloat(format('%.1f', [CDS_PH.fieldbyname('Qty').AsFloat * num1]));
if i = 3 then
kcQty := strtofloat(format('%.1f', [CDS_PH.fieldbyname('Qty').AsFloat / num1]));
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add(' Update CK_BanCP_KC Set ZDYFlote1=KCqty ');
sql.Add(' where CRID=' + CDS_PH.Fieldbyname('CRID').AsString);
sql.Add(' and ZDYFlote1=0 ');
sql.Add(' Update CK_BanCP_KC Set kcqty=''' + floattostr(kcQty) + ''',ZDYStr1=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' ');
sql.Add(' where CRID=' + CDS_PH.Fieldbyname('CRID').AsString);
sql.Add(' Update CK_BanCP_KC Set kcRollNum=0 ');
sql.Add(' where CRID=' + CDS_PH.Fieldbyname('CRID').AsString);
sql.Add(' and kcqty=0 and kcRollNum<>0 ');
sql.Add(' Update CK_BanCP_PH Set Qty=''' + floattostr(kcQty) + ''' ');
sql.Add(' where PHID=' + quotedstr(trim(CDS_PH.Fieldbyname('PHID').AsString)));
ExecSQL;
end;
Edit;
FieldByName('qty').Value := kcQty;
FieldByName('kcqty').Value := kcQty;
FieldByName('SSel').Value := False;
post;
end;
end;
ADOQueryCmd.Connection.CommitTrans;
// initGrid();
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>!', '<27><>ʾ', 0);
Exit;
except
ADOQueryCmd.Connection.RollbackTrans;
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>쳣!', '<27><>ʾ', 0);
end;
end;
procedure TfrmProductOrder_Ph.ToolButton9Click(Sender: TObject);
var
fPrintFile: string;
Txt, fImagePath: string;
Moudle: THandle;
Makebar: TMakebar;
Mixtext: TMixtext;
begin
if CDS_PH.IsEmpty then
Exit;
if CDS_PH.Locate('SSel', True, []) = False then
begin
Application.MessageBox(<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
Exit;
end;
CDS_PH.DisableControls;
with CDS_PH do
begin
First;
while not Eof do
begin
if CDS_PH.FieldByName('SSel').AsBoolean = True then
begin
try
Moudle := LoadLibrary('MakeQRBarcode.dll');
@Makebar := GetProcAddress(Moudle, 'Make');
@Mixtext := GetProcAddress(Moudle, 'MixText');
Txt := Trim(CDS_PH.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_PH.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.*,kcQty as mjlen,kcQtyUnit as MJTypeother ');
sql.Add(' from CK_BanCP_KC A');
SQL.Add(' where A.MJID=''' + Trim(CDS_PH.fieldbyname('MJID').AsString) + '''');
SQL.Add(' and KCQty>0 ');
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_PH.EnableControls;
Application.MessageBox(PChar(<><C3BB><EFBFBD><EFBFBD>' + ExtractFilePath(Application.ExeName) + 'Report\<5C><><EFBFBD><EFBFBD>ǩ.rmf'), '<27><>ʾ', 0);
Exit;
end;
end;
Next;
end;
end;
CDS_PH.EnableControls;
end;
procedure TfrmProductOrder_Ph.TdbchexiaoClick(Sender: TObject);
begin
if CDS_PH.IsEmpty then
exit;
CDS_PH.first;
try
if Application.MessageBox(<><C8B7>Ҫִ<D2AA>в<EFBFBD><D0B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
Exit;
ADOQueryCmd.Connection.BeginTrans;
while not CDS_PH.eof do
begin
if CDS_PH.FieldByName('ssel').AsBoolean then
begin
with ADOQueryTemp do
begin
Close;
sql.Clear;
sql.Add('select * from YF_Money_CR ');
sql.Add(' where MainID=''' + Trim(Order_Main.fieldbyname('MainID').AsString) + '''');
sql.Add(' and subID=''' + Trim(Order_Main.fieldbyname('subID').AsString) + '''');
sql.Add(' and YFName=''<27><><EFBFBD>۽<EFBFBD><DBBD><EFBFBD>'' ');
sql.Add(' and status>=''1'' ');
Open;
if not ADOQueryTemp.IsEmpty then
begin
ADOQueryCmd.Connection.RollbackTrans;
Application.MessageBox(<>տ<EFBFBD>û<EFBFBD>г<EFBFBD><D0B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˣ<EFBFBD><CBA3><EFBFBD><EFBFBD>ܳ<EFBFBD><DCB3><EFBFBD>!', '<27><>ʾ', 0);
exit;
end;
end;
with ADOQueryCmd do
begin
close;
sql.Clear;
sql.Add('update CK_BanCP_KC SET kcstatus=null ');
sql.Add('from CK_BanCP_KC A ');
sql.Add('inner join CK_BanCP_PH B on B.CRID=A.CRID ');
sql.Add('where B.PHID=' + quotedstr(trim(CDS_PH.fieldbyname('PHID').AsString)));
execsql;
end;
with ADOQueryCmd do
begin
close;
sql.Clear;
sql.Add('delete from CK_BanCP_PH ');
sql.Add('where PHID=' + quotedstr(trim(CDS_PH.fieldbyname('PHID').AsString)));
execsql;
end;
end;
CDS_PH.next;
end;
with ADOQueryTemp do
begin
close;
sql.Clear;
sql.Add('select * from CK_BanCP_PH ');
sql.Add('where mainID=' + quotedstr(trim(Order_Main.fieldbyname('mainID').AsString)));
sql.Add('and subID=' + quotedstr(trim(Order_Main.fieldbyname('subID').AsString)));
open;
end;
if ADOQueryTemp.IsEmpty then
begin
with ADOQueryCmd do
begin
close;
sql.Clear;
sql.Add('select * from JYOrder_sub ');
sql.Add('where mainID=' + quotedstr(trim(Order_Main.fieldbyname('mainID').AsString)));
sql.Add('and subID=' + quotedstr(trim(Order_Main.fieldbyname('subID').AsString)));
open;
edit;
fieldbyname('substatus').Value := '0';
post;
end;
end;
CDS_PH.first;
ADOQueryCmd.Connection.CommitTrans;
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>!', '<27><>ʾ', 0);
Exit;
except
ADOQueryCmd.Connection.RollbackTrans;
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>쳣!', '<27><>ʾ', 0);
end;
end;
end.