269 lines
7.4 KiB
ObjectPascal
269 lines
7.4 KiB
ObjectPascal
unit U_YarnPurOutReturn;
|
||
|
||
interface
|
||
|
||
uses
|
||
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
||
Dialogs, cxGraphics, cxCustomData, cxStyles, cxTL, cxMaskEdit, DB, ADODB,
|
||
cxInplaceContainer, cxDBTL, cxControls, cxTLData, ComCtrls, ToolWin, StdCtrls,
|
||
cxFilter, cxData, cxDataStorage, cxEdit, cxDBData, DBClient,
|
||
cxGridCustomTableView, cxGridTableView, cxGridDBTableView, ExtCtrls,
|
||
cxSplitter, cxGridLevel, cxClasses, cxGridCustomView, cxGrid,
|
||
cxGridCustomPopupMenu, cxGridPopupMenu, RM_Dataset, RM_System, RM_Common,
|
||
RM_Class, RM_GridReport, IdBaseComponent, IdComponent, IdTCPConnection,
|
||
IdTCPClient, IdFTP, ShellAPI, IniFiles, cxCheckBox, cxCalendar, cxButtonEdit,
|
||
cxTextEdit, cxDropDownEdit, BtnEdit, cxLookAndFeels, cxLookAndFeelPainters,
|
||
cxNavigator, U_BaseInput, cxContainer,
|
||
dxCore, cxDateUtils, cxCurrencyEdit, cxMemo, System.ImageList,
|
||
Vcl.ImgList, dxSkinsCore, dxSkinsDefaultPainters, cxImageList,
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
dxSkinOffice2013White,
|
||
|
||
|
||
dxSkinSharpPlus,
|
||
|
||
|
||
|
||
dxSkinWXI, ;
|
||
|
||
type
|
||
TfrmYarnPurOutReturn = class(TfrmBaseInput)
|
||
ToolBar1: TToolBar;
|
||
TBClose: TToolButton;
|
||
ADOQueryTemp: TADOQuery;
|
||
ADOQueryCmd: TADOQuery;
|
||
ADOQueryMain: TADOQuery;
|
||
ToolButton3: TToolButton;
|
||
ScrollBox1: TScrollBox;
|
||
Label2: TLabel;
|
||
Y_Code: TcxTextEdit;
|
||
Label8: TLabel;
|
||
StkCoName: TcxButtonEdit;
|
||
lbl5: TLabel;
|
||
IOTime: TcxDateEdit;
|
||
Label10: TLabel;
|
||
Label11: TLabel;
|
||
Qty: TcxCurrencyEdit;
|
||
Piece: TcxCurrencyEdit;
|
||
Label6: TLabel;
|
||
Y_Name: TcxTextEdit;
|
||
Label9: TLabel;
|
||
FromCoName: TcxTextEdit;
|
||
Label4: TLabel;
|
||
Y_Color: TcxTextEdit;
|
||
Label5: TLabel;
|
||
Y_ColorNo: TcxTextEdit;
|
||
Label1: TLabel;
|
||
JGMoney: TcxCurrencyEdit;
|
||
Label3: TLabel;
|
||
Price: TcxCurrencyEdit;
|
||
Label7: TLabel;
|
||
Price2: TcxCurrencyEdit;
|
||
procedure FormDestroy(Sender: TObject);
|
||
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
||
procedure TBCloseClick(Sender: TObject);
|
||
procedure FormShow(Sender: TObject);
|
||
procedure TBRafreshClick(Sender: TObject);
|
||
procedure ToolButton3Click(Sender: TObject);
|
||
procedure BuyNamePropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
||
procedure CoBusinessTypeDblClick(Sender: TObject);
|
||
procedure FormCreate(Sender: TObject);
|
||
procedure JGMoneyPropertiesEditValueChanged(Sender: TObject);
|
||
private
|
||
{ Private declarations }
|
||
procedure InitGrid();
|
||
function SaveData(): Boolean;
|
||
public
|
||
{ Public declarations }
|
||
FBYIOID: string;
|
||
end;
|
||
|
||
var
|
||
frmYarnPurOutReturn: TfrmYarnPurOutReturn;
|
||
|
||
implementation
|
||
|
||
uses
|
||
U_DataLink, U_RTFun, U_ZDYHelp, U_CompanySel;
|
||
|
||
{$R *.dfm}
|
||
|
||
procedure TfrmYarnPurOutReturn.InitGrid();
|
||
begin
|
||
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add(' select A.*,RKPrice=(select Price from BS_Yarn_IO X where X.BYIOID =A.StkID) ');
|
||
sql.Add(' from BS_Yarn_IO A ');
|
||
sql.Add(' where A.BYIOID=''' + Trim(FBYIOID) + '''');
|
||
Open;
|
||
end;
|
||
FromCoName.Text := ADOQueryTemp.FieldByName('ToCoName').ASString;
|
||
Y_Code.Text := ADOQueryTemp.FieldByName('Y_Code').ASString;
|
||
Y_Name.Text := ADOQueryTemp.FieldByName('Y_Name').ASString;
|
||
Y_ColorNo.Text := ADOQueryTemp.FieldByName('Y_ColorNo').ASString;
|
||
Y_Color.Text := ADOQueryTemp.FieldByName('Y_Color').ASString;
|
||
|
||
Price.Text := ADOQueryTemp.FieldByName('RKPrice').ASString;
|
||
end;
|
||
|
||
procedure TfrmYarnPurOutReturn.JGMoneyPropertiesEditValueChanged(Sender: TObject);
|
||
begin
|
||
Price2.text := floattostr(strtofloatdef(Price.text, 0) + strtofloatdef(JGMoney.text, 0));
|
||
end;
|
||
|
||
procedure TfrmYarnPurOutReturn.FormDestroy(Sender: TObject);
|
||
begin
|
||
inherited;
|
||
frmYarnPurOutReturn := nil;
|
||
end;
|
||
|
||
procedure TfrmYarnPurOutReturn.BuyNamePropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
||
begin
|
||
try
|
||
frmCompanySel := TfrmCompanySel.Create(Application);
|
||
with frmCompanySel do
|
||
begin
|
||
FCoType := '<27><>Ӧ<EFBFBD><D3A6>';
|
||
if ShowModal = 1 then
|
||
begin
|
||
self.StkCoName.Properties.LookupItems.Text := Trim(frmCompanySel.CDS_1.fieldbyname('CoCode').AsString);
|
||
self.StkCoName.Text := Trim(frmCompanySel.CDS_1.fieldbyname('CoAbbrName').AsString);
|
||
end;
|
||
end;
|
||
|
||
finally
|
||
frmCompanySel.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmYarnPurOutReturn.CoBusinessTypeDblClick(Sender: TObject);
|
||
begin
|
||
TcxButtonEdit(Sender).Text := '';
|
||
TcxButtonEdit(Sender).Properties.LookupItems.Text := '';
|
||
end;
|
||
|
||
procedure TfrmYarnPurOutReturn.FormClose(Sender: TObject; var Action: TCloseAction);
|
||
begin
|
||
inherited;
|
||
Action := caFree;
|
||
end;
|
||
|
||
procedure TfrmYarnPurOutReturn.FormCreate(Sender: TObject);
|
||
begin
|
||
inherited;
|
||
IOTime.Date := SGetServerDate(ADOQueryTemp);
|
||
end;
|
||
|
||
procedure TfrmYarnPurOutReturn.TBCloseClick(Sender: TObject);
|
||
begin
|
||
|
||
close;
|
||
end;
|
||
|
||
procedure TfrmYarnPurOutReturn.FormShow(Sender: TObject);
|
||
var
|
||
i: integer;
|
||
a: string;
|
||
begin
|
||
inherited;
|
||
InitGrid();
|
||
end;
|
||
|
||
procedure TfrmYarnPurOutReturn.TBRafreshClick(Sender: TObject);
|
||
begin
|
||
InitGrid();
|
||
end;
|
||
|
||
function TfrmYarnPurOutReturn.SaveData(): Boolean;
|
||
var
|
||
MBCIOID, Maxno: string;
|
||
begin
|
||
try
|
||
ADOQueryCmd.Connection.BeginTrans;
|
||
|
||
if not GetLSNo(ADOQueryCmd, Maxno, 'Z', 'BS_Cloth_IO', 4, 1) then
|
||
raise Exception.Create('ȡȾɫ<C8BE><C9AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>');
|
||
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
Sql.Clear;
|
||
sql.Add('insert into Finance_Need_Up(UType,UDataId,UOperation,UOperator,UModule,UDetails) ');
|
||
sql.Add('values(''ɴ<><C9B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' ');
|
||
sql.Add(',' + quotedstr(Trim(Maxno)));
|
||
sql.Add(',''<27><><EFBFBD><EFBFBD>'' ');
|
||
sql.Add(',' + quotedstr(DName));
|
||
sql.Add(',' + quotedstr(trim(self.Caption)));
|
||
sql.Add(',' + quotedstr(Trim(Maxno)));
|
||
sql.Add(') ');
|
||
|
||
Sql.Add('exec P_BS_Yarn_OutReturn ');
|
||
Sql.Add(' @BYIOID=' + quotedstr(Trim(FBYIOID)));
|
||
Sql.Add(',@Maxno=' + quotedstr(Trim(Maxno)));
|
||
Sql.Add(',@IOTime=' + quotedstr(Trim(Trim(FormatDateTime('yyyy-MM-dd', IOTime.Date)))));
|
||
Sql.Add(',@StkCoNo=' + quotedstr(Trim(StkCoName.Properties.LookupItems.Text)));
|
||
Sql.Add(',@StkCoName=' + quotedstr(Trim(StkCoName.Text)));
|
||
Sql.Add(',@Y_Color=' + quotedstr(Trim(Y_Color.Text)));
|
||
Sql.Add(',@Y_ColorNo=' + quotedstr(Trim(Y_ColorNo.Text)));
|
||
Sql.Add(',@Piece=' + Piece.Text);
|
||
Sql.Add(',@Qty=' + Qty.Text);
|
||
|
||
Sql.Add(',@Price=' + Price.Text);
|
||
Sql.Add(',@JGMoney=' + JGMoney.Text);
|
||
Sql.Add(',@Price2=' + Price2.Text);
|
||
|
||
Sql.Add(',@DCode=' + quotedstr(Trim(DCode)));
|
||
Sql.Add(',@DName=' + quotedstr(Trim(DName)));
|
||
Open;
|
||
end;
|
||
if ADOQueryCmd.FieldByName('intReturn').AsInteger = -1 then
|
||
raise Exception.Create(pchar(trim(ADOQueryCmd.FieldByName('ShowMsg').AsString)));
|
||
|
||
ADOQueryCmd.Connection.CommitTrans;
|
||
Result := True;
|
||
except
|
||
Result := False;
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
application.MessageBox(PChar(Exception(ExceptObject).Message), '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
||
end;
|
||
|
||
end;
|
||
|
||
procedure TfrmYarnPurOutReturn.ToolButton3Click(Sender: TObject);
|
||
begin
|
||
|
||
if Trim(StkCoName.Text) = '' then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD>ŵ<EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
if Trim(Piece.Text) = '' then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
if Trim(Qty.Text) = '' then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
if SaveData() then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>!', '<27><>ʾ', 0);
|
||
ModalResult := 1;
|
||
end;
|
||
end;
|
||
|
||
end.
|
||
|