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

1938 lines
58 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_OrderInPut;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData, cxDataStorage,
cxEdit, DB, cxDBData, cxGridLevel, cxGridCustomTableView, cxGridTableView,
cxGridDBTableView, cxClasses, cxControls, cxGridCustomView, cxGrid, cxMemo,
cxRichEdit, ComCtrls, cxContainer, cxTextEdit, cxMaskEdit, cxButtonEdit,
StdCtrls, ToolWin, DBClient, ADODB, ExtCtrls, BtnEdit, cxCalendar, StrUtils,
cxGridCustomPopupMenu, cxGridPopupMenu, cxDBLookupComboBox, cxLookAndFeels,
cxLookAndFeelPainters, cxNavigator, cxDropDownEdit, 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
TfrmOrderInPut = class(TForm)
ToolBar1: TToolBar;
TBSave: TToolButton;
TBClose: TToolButton;
ScrollBox1: TScrollBox;
Label1: TLabel;
Label3: TLabel;
OrderNo: TEdit;
OrdDate: TDateTimePicker;
Label4: TLabel;
DlyDate: TDateTimePicker;
Label7: TLabel;
Label8: TLabel;
ToolBar2: TToolBar;
ToolButton1: TToolButton;
ToolButton2: TToolButton;
cxGrid1: TcxGrid;
Tv1: TcxGridDBTableView;
cxGrid1Level1: TcxGridLevel;
v1PRTColor: TcxGridDBColumn;
v1PRTPrice: TcxGridDBColumn;
ADOTemp: TADOQuery;
ADOCmd: TADOQuery;
DataSource1: TDataSource;
Order_Sub: TClientDataSet;
ADOQuery1: TADOQuery;
v1PRTOrderQty: TcxGridDBColumn;
Label9: TLabel;
Label10: TLabel;
ConNo: TEdit;
Label11: TLabel;
OrdDefStr1: TEdit;
Label14: TLabel;
Label20: TLabel;
JGFactoryName: TBtnEditC;
CustomerNoName: TBtnEditC;
v1XHNo: TcxGridDBColumn;
OrdDefStr2: TBtnEditC;
v1OrderUnit: TcxGridDBColumn;
v1SOrddefstr1: TcxGridDBColumn;
v1PriceUnit: TcxGridDBColumn;
Label2: TLabel;
MPRTCodeName: TBtnEditC;
Label5: TLabel;
MPRTCF: TBtnEditC;
Label6: TLabel;
MPRTSpec: TBtnEditC;
Label12: TLabel;
MPRTMF: TBtnEditC;
Label13: TLabel;
MPRTKZ: TBtnEditC;
Label15: TLabel;
MPRTSL: TBtnEditC;
Label16: TLabel;
OrdDefStr3: TBtnEditC;
Note: TMemo;
Label17: TLabel;
OrdPerson2: TEdit;
v1Column2: TcxGridDBColumn;
ToolButton3: TToolButton;
v1Column4: TcxGridDBColumn;
v1Column5: TcxGridDBColumn;
v1Column7: TcxGridDBColumn;
v1Column6: TcxGridDBColumn;
v1Column8: TcxGridDBColumn;
v1PRTRollNum: TcxGridDBColumn;
cxGridPopupMenu1: TcxGridPopupMenu;
Label18: TLabel;
FHAddress: TBtnEditC;
Label19: TLabel;
LXFS: TBtnEditC;
Label21: TLabel;
orddefnote1: TMemo;
v1Sorddefnote1: TcxGridDBColumn;
Panel1: TPanel;
Label22: TLabel;
Label23: TLabel;
v1Column9: TcxGridDBColumn;
v1Column10: TcxGridDBColumn;
v1Column11: TcxGridDBColumn;
v1Column12: TcxGridDBColumn;
v1Column13: TcxGridDBColumn;
v1Column14: TcxGridDBColumn;
v1Column15: TcxGridDBColumn;
v1Column16: TcxGridDBColumn;
OrdPerson1: TBtnEditA;
Label24: TLabel;
v1Column17: TcxGridDBColumn;
v1Column18: TcxGridDBColumn;
SYRName: TComboBox;
Label25: TLabel;
v1gangFee: TcxGridDBColumn;
GroupBox1: TGroupBox;
Label26: TLabel;
Label27: TLabel;
Edit1: TEdit;
Edit2: TEdit;
Button1: TButton;
Edit3: TEdit;
Label28: TLabel;
orderType: TComboBox;
v1YunFee: TcxGridDBColumn;
v1OtherFee: TcxGridDBColumn;
cxGrid4: TcxGrid;
TV4: TcxGridDBTableView;
V4Column1: TcxGridDBColumn;
V4Column5: TcxGridDBColumn;
V4Column3: TcxGridDBColumn;
cxGrid4Level1: TcxGridLevel;
ADO_KH: TADOQuery;
DS_KH: TDataSource;
Label29: TLabel;
Label30: TLabel;
ADOQueryCP: TADOQuery;
DSCP: TDataSource;
Label31: TLabel;
Label32: TLabel;
Panel2: TPanel;
procedure TBCloseClick(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure TBSaveClick(Sender: TObject);
procedure v1PRTColorPropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
procedure ToolButton1Click(Sender: TObject);
procedure ToolButton2Click(Sender: TObject);
procedure JGFactoryNameBtnUpClick(Sender: TObject);
procedure CustomerNoNameBtnUpClick(Sender: TObject);
procedure CustomerNoNameBtnDnClick(Sender: TObject);
procedure v1Column1PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
procedure OrdDefStr3BtnUpClick(Sender: TObject);
procedure MPRTCodeNameBtnUpClick(Sender: TObject);
procedure NoteDblClick(Sender: TObject);
procedure v1OrderUnitPropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
procedure v1PriceUnitPropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
procedure jKeyPress(Sender: TObject; var Key: Char);
procedure OrdDefStr2BtnUpClick(Sender: TObject);
procedure ConNoKeyPress(Sender: TObject; var Key: Char);
procedure ToolButton3Click(Sender: TObject);
procedure v1Column6PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
procedure v1Column8PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
procedure v1Column5PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
procedure v1Column7PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
procedure FHAddressBtnUpClick(Sender: TObject);
procedure LXFSBtnUpClick(Sender: TObject);
procedure v1Column5PropertiesEditValueChanged(Sender: TObject);
procedure v1PRTColorPropertiesEditValueChanged(Sender: TObject);
procedure Tv1FocusedRecordChanged(Sender: TcxCustomGridTableView; APrevFocusedRecord, AFocusedRecord: TcxCustomGridRecord; ANewItemRecordFocusingChanged: Boolean);
procedure OrdPerson1BtnClick(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure OrdDateChange(Sender: TObject);
procedure CustomerNoNameChange(Sender: TObject);
procedure TV4CellDblClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
procedure TV4KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
procedure CustomerNoNameKeyPress(Sender: TObject; var Key: Char);
procedure Tv1CellClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
private
procedure InitData();
procedure ZDYHelp(FButn: TcxButtonEdit; LType: string);
function SaveData(): Boolean;
procedure DoKc();
{ Private declarations }
public
PState, CopyInt, PriceFlag: Integer;
FMainId, FFMainId, FOrderNo: string;
FXS: Integer;
fCustomerNoName: string;
forderType: string;
fsyrName: string;
{ Public declarations }
end;
var
frmOrderInPut: TfrmOrderInPut;
newh: hwnd;
implementation
uses
U_DataLink, U_ZDYHelp, U_Fun, U_ZDYHelpSel, U_ZdyAttachment, U_ZdyAttachCP,
U_UserHelp;
{$R *.dfm}
procedure TfrmOrderInPut.DoKc();
var
i: integer;
begin
Label22.Caption := <><C6A5><EFBFBD><EFBFBD>0';
Label23.Caption := '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>0';
if Order_Sub.IsEmpty then
exit;
if trim(Order_Sub.fieldbyname('PRTCodeName').AsString) = '' then
exit;
if trim(Order_Sub.fieldbyname('PRTColor').AsString) = '' then
exit;
if trim(fsyrName) = '<27>𻪷<EFBFBD>֯' then
begin
with ADOTemp do
begin
close;
sql.Clear;
SQL.Add('SELECT sum(A.KCRollnum) as KCRollnum,sum(A.KCQty) as kcQty FROM CK_BanCP_KC A');
// sql.Add('exec P_Get_HCKCList ');
sql.Add(' where C_CodeName=' + quotedstr(trim(Order_Sub.fieldbyname('PRTCodeName').AsString)));
sql.Add(' and C_Color=' + quotedstr(trim(Order_Sub.fieldbyname('PRTColor').AsString)));
sql.Add(' and A.KCQty>0 and A.CPType not in(''һ<>ȴ<EFBFBD>Ʒ'',''<27><><EFBFBD>ȴ<EFBFBD>Ʒ'') and isnull(A.kcstatus,'''')='''' ');
open;
end;
end
else
begin
with ADOTemp do
begin
close;
sql.Clear;
SQL.Add('SELECT sum(A.KCRollnum) as KCRollnum,sum(A.KCQty) as kcQty FROM CK_BanCP_KC1 A');
// sql.Add('exec P_Get_HCKCList ');
sql.Add(' where C_CodeName=' + quotedstr(trim(Order_Sub.fieldbyname('PRTCodeName').AsString)));
sql.Add(' and C_Color=' + quotedstr(trim(Order_Sub.fieldbyname('PRTColor').AsString)));
sql.Add(' and A.KCQty>0 and A.CPType not in(''һ<>ȴ<EFBFBD>Ʒ'',''<27><><EFBFBD>ȴ<EFBFBD>Ʒ'') and isnull(A.kcstatus,'''')='''' ');
open;
end;
end;
if not ADOTemp.IsEmpty then
begin
Label22.Caption := '<27><><EFBFBD><EFBFBD>ƥ<EFBFBD><C6A5><EFBFBD><EFBFBD>' + trim(ADOTemp.fieldbyname('kcRollNum').AsString);
Label23.Caption := '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' + trim(ADOTemp.fieldbyname('kcQty').AsString);
end;
Label29.Caption := '';
Label30.Caption := '';
Label32.Caption := '';
with ADOTemp do
begin
close;
sql.Clear;
SQL.Add(' SELECT Top 3 Price,CRTime FROM YF_Money_CR A');
sql.Add(' where P_CodeName=' + quotedstr(trim(Order_Sub.fieldbyname('PRTCodeName').AsString)));
sql.Add(' and P_Color=' + quotedstr(trim(Order_Sub.fieldbyname('PRTColor').AsString)));
sql.Add(' and factoryName=' + quotedstr(trim(CustomerNoName.Text)));
sql.Add(' and syrName=''' + fsyrName + ''' ');
if trim(orderType.Text) = '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then
sql.Add(' and YFName=''<27><>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>'' ')
else
sql.Add(' and YFName=''<27><><EFBFBD>۽<EFBFBD><DBBD><EFBFBD>'' ');
sql.Add(' and price>0 ');
sql.Add(' order by FillTime desc');
open;
end;
i := 1;
if not ADOTemp.IsEmpty then
begin
Label29.Caption := '<27><><EFBFBD>ۣ<EFBFBD>';
// Label29.Caption:='<27><><EFBFBD>ۣ<EFBFBD>'+trim(ADOTemp.fieldbyname('price').AsString);
while not ADOTemp.Eof do
begin
Label29.Caption := Label29.Caption + formatdateTime('yyyy-MM-dd', ADOTemp.fieldbyname('CRTime').AsDateTime) + '<' + ADOTemp.fieldbyname('Price').AsString + '> ';
i := i + 1;
ADOTemp.Next;
end;
end;
end;
procedure TfrmOrderInPut.TBCloseClick(Sender: TObject);
begin
Close;
WriteCxGrid(ʾ<D6B8><CABE>¼<EFBFBD><C2BC>1', Tv1, '<27><><EFBFBD><EFBFBD>ָʾ<D6B8><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
end;
procedure TfrmOrderInPut.InitData();
begin
with ADOQuery1 do
begin
Close;
SQL.Clear;
sql.Add(' select * from JYOrder_Sub ');
if PState = 1 then
begin
sql.Add('where MainId=''' + Trim(FMainId) + '''');
end;
if PState = 0 then
begin
sql.Add(' where 1<>1');
end;
Open;
end;
SCreateCDS20(ADOQuery1, Order_Sub);
SInitCDSData20(ADOQuery1, Order_Sub);
with ADOQuery1 do
begin
Close;
sql.Clear;
sql.Add('select * from JYOrder_Main where MainId=''' + Trim(FMainId) + '''');
Open;
end;
CustomerNoName.OnChange := nil;
SCSHDataNew(ADOQuery1, ScrollBox1, 2);
if PState = 0 then
begin
OrdDate.DateTime := SGetServerDate10(ADOTemp);
DlyDate.DateTime := SGetServerDate10(ADOTemp);
OrdPerson1.Text := Trim(DName);
if fCustomerNoName = '<27><EFBFBD><E3B6AB><EFBFBD>в<EFBFBD>' then
begin
CustomerNoName.Text := trim(fCustomerNoName);
orderType.ItemIndex := 0;
end;
end
else
begin
end;
if CopyInt = 99 then
begin
PState := 0;
FMainId := '';
// OrdPerson1.Text:=Trim(DName);
OrderNo.Text := '';
orddefnote1.Text := '';
with Order_Sub do
begin
First;
while not Eof do
begin
Edit;
FieldByName('MainId').Value := '';
FieldByName('SubId').Value := '';
Post;
Next;
end;
end;
end;
if PState = 0 then
begin
OrderNo.Text := '<27>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD>';
OrderNo.Enabled := false;
end;
CustomerNoName.OnChange := CustomerNoNameChange;
end;
procedure TfrmOrderInPut.ZDYHelp(FButn: TcxButtonEdit; LType: string);
var
FType, ZDYName, FText: string;
begin
end;
procedure TfrmOrderInPut.FormShow(Sender: TObject);
begin
readCxGrid(ʾ<D6B8><CABE>¼<EFBFBD><C2BC>1', Tv1, '<27><><EFBFBD><EFBFBD>ָʾ<D6B8><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
SYRName.Items.Clear;
with ADOCmd do
begin
close;
sql.Clear;
sql.Add('select * from KH_ZDY where Type=''SYRNAME''');
open;
if not IsEmpty then
begin
while not eof do
begin
SYRName.Items.Add(trim(fieldbyname('zdyname').AsString));
next;
end;
SYRName.ItemIndex := 0;
end;
end;
if PriceFlag = 99 then
begin
v1PRTPrice.Visible := False;
v1PRTPrice.Hidden := True;
end;
if PState = 1 then
begin
Label21.Visible := true;
orddefnote1.Visible := true;
end;
orderType.Items.Clear;
orderType.Items.Add(fOrderType);
if fOrderType = '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then
begin
GroupBox1.Visible := true;
v1gangFee.Visible := false;
v1yunFee.Visible := false;
v1otherFee.Visible := false;
end
else
begin
GroupBox1.Visible := false;
v1gangFee.Visible := true;
v1yunFee.Visible := true;
v1otherFee.Visible := true;
end;
orderType.ItemIndex := 0;
if trim(fsyrName) <> '' then
begin
SYRName.Items.Clear;
SYRName.Items.Add(fsyrName);
SYRName.ItemIndex := 0;
SYRName.Enabled := false;
// orderType.Enabled:=false;
end;
InitData();
end;
function TfrmOrderInPut.SaveData(): Boolean;
var
maxno: string;
i: integer;
begin
if Trim(FMainId) = '' then
begin
if GetLSNo(ADOTemp, maxno, 'JM', 'JYOrder_Main', 3, 1) = False then
begin
Application.MessageBox(<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>!', '<27><>ʾ', 0);
Exit;
end;
end
else
begin
maxno := Trim(FMainId);
end;
try
ADOCmd.Connection.BeginTrans;
///<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
with ADOCmd do
begin
Close;
sql.Clear;
SQL.Add('select * from JYOrder_Main where MainId=''' + Trim(FMainId) + '''');
Open;
end;
with ADOCmd do
begin
if Trim(FMainId) = '' then
begin
Append;
end
else
begin
Edit;
end;
FieldByName('MainId').Value := Trim(maxno);
SSetsaveSqlNew(ADOCmd, 'JYOrder_Main', ScrollBox1, 2);
if PState = 1 then
begin
FieldByName('BHZDStatus').Value := '1';
end;
if Trim(FMainId) = '' then
begin
FieldByName('Filler').Value := Trim(DName);
end
else
begin
FieldByName('Filler').Value := Trim(DName);
FieldByName('Editer').Value := Trim(DName);
FieldByName('EditTime').Value := SGetServerDateTime(ADOTemp);
end;
if trim(orderType.Text) = '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then
begin
if PState = 1 then
begin
end
else
begin
FieldByName('status').Value := '1';
end;
end
else
FieldByName('status').Value := '0';
FieldByName('Note').Value := Trim(Note.Text);
Post;
end;
FMainId := Trim(maxno);
with ADOCmd do
begin
Close;
sql.Clear;
sql.Add('select * from JYOrder_Main where orderno=''' + Trim(OrderNo.Text) + '''');
Open;
end;
if ADOCmd.RecordCount > 1 then
begin
ADOCmd.Connection.RollbackTrans;
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ظ<EFBFBD>!', '<27><>ʾ', 0);
Exit;
end;
if PState = 1 then
begin
with ADOCmd do
begin
Close;
sql.Clear;
sql.Add('insert into SY_SysLog(operor,opertime,Model,acction,opevent,result) values( ');
sql.Add(' ' + quotedstr(trim(DName)));
sql.Add(',getdate() ');
sql.Add(',' + quotedstr(trim(self.Caption)));
sql.Add(',' + quotedstr(trim('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>޸<EFBFBD>')));
sql.Add(',' + quotedstr(trim('<27>޸<EFBFBD>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ţ<EFBFBD>' + trim(FOrderNo))) + quotedstr(trim('<27>޸ĺ<DEB8><C4BA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ţ<EFBFBD>' + trim(OrderNo.text))));
sql.Add(',' + quotedstr(trim('<27>ɹ<EFBFBD>')));
sql.Add(')');
ExecSQL;
end;
end;
with ADOCmd do
begin
Close;
sql.Clear;
SQL.Add('delete from JYOrder_Sub where MainId=''' + Trim(FMainId) + '''');
execsql;
end;
///<2F><><EFBFBD><EFBFBD><EFBFBD>ӱ<EFBFBD>
with Order_Sub do
begin
DisableControls;
First;
while not Eof do
begin
if Trim(Order_Sub.fieldbyname('SubId').AsString) = '' then
begin
if GetLSNo(ADOTemp, maxno, 'JS', 'JYOrder_Sub', 4, 1) = False then
begin
ADOCmd.Connection.RollbackTrans;
Application.MessageBox(<><C8A1><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ', 0);
Exit;
end;
end
else
begin
maxno := Trim(Order_Sub.fieldbyname('SubId').AsString);
end;
with ADOCmd do
begin
Close;
SQL.Clear;
sql.Add('select * from JYOrder_Sub where MainId=''' + Trim(FMainId) + '''');
sql.Add(' and SubId=''' + Trim(maxno) + '''');
Open;
end;
if Fieldbyname('PRTRollNum').AsFloat = 0 then
begin
i := 0;
if fieldbyname('SordQty1').AsFloat <> 0 then
i := i + 1;
if fieldbyname('SordQty2').AsFloat <> 0 then
i := i + 1;
if fieldbyname('SordQty3').AsFloat <> 0 then
i := i + 1;
if fieldbyname('SordQty4').AsFloat <> 0 then
i := i + 1;
if fieldbyname('SordQty5').AsFloat <> 0 then
i := i + 1;
if fieldbyname('SordQty6').AsFloat <> 0 then
i := i + 1;
if fieldbyname('SordQty7').AsFloat <> 0 then
i := i + 1;
if fieldbyname('SordQty8').AsFloat <> 0 then
i := i + 1;
if fieldbyname('SordQty9').AsFloat <> 0 then
i := i + 1;
if fieldbyname('SordQty10').AsFloat <> 0 then
i := i + 1;
edit;
fieldbyname('PRTRollNum').Value := i;
post;
end;
with ADOTemp do
begin
close;
sql.Clear;
sql.Add('select * from KH_Zdy_Attachment A ');
sql.Add('where zdyName=' + quotedstr(trim(Order_Sub.fieldbyname('PRTCodeName').AsString)));
sql.Add('and DEFstr3=' + quotedstr(trim(Order_Sub.fieldbyname('PRTColor').AsString)));
open;
end;
if not ADOTemp.IsEmpty then
begin
edit;
fieldbyname('PRTPrice').Value := fieldbyname('PRTPrice').AsFloat + ADOTemp.fieldbyname('defflt1').AsFloat;
post;
end;
with ADOCmd do
begin
if Trim(Order_Sub.fieldbyname('SubId').AsString) = '' then
Append
else
Edit;
FieldByName('orderNo').Value := Trim(orderNo.Text);
FieldByName('MainId').Value := Trim(FMainId);
FieldByName('SubId').Value := Trim(maxno);
RTSetSaveDataCDS(ADOCmd, Tv1, Order_Sub, 'JYOrder_Sub', 0);
fieldbyname('PRTOrderQty').Value := Order_Sub.fieldbyname('PRTOrderQty').AsFloat;
fieldbyname('PRTRollNum').Value := Order_Sub.fieldbyname('PRTRollNum').AsFloat;
fieldbyname('gangNum').Value := Order_Sub.fieldbyname('gangNum').AsFloat;
fieldbyname('SordQty1').Value := Order_Sub.fieldbyname('SordQty1').AsFloat;
fieldbyname('SordQty2').Value := Order_Sub.fieldbyname('SordQty2').AsFloat;
fieldbyname('SordQty3').Value := Order_Sub.fieldbyname('SordQty3').AsFloat;
fieldbyname('SordQty4').Value := Order_Sub.fieldbyname('SordQty4').AsFloat;
fieldbyname('SordQty5').Value := Order_Sub.fieldbyname('SordQty5').AsFloat;
fieldbyname('SordQty6').Value := Order_Sub.fieldbyname('SordQty6').AsFloat;
fieldbyname('SordQty7').Value := Order_Sub.fieldbyname('SordQty7').AsFloat;
fieldbyname('SordQty8').Value := Order_Sub.fieldbyname('SordQty8').AsFloat;
fieldbyname('SordQty9').Value := Order_Sub.fieldbyname('SordQty9').AsFloat;
fieldbyname('SordQty10').Value := Order_Sub.fieldbyname('SordQty10').AsFloat;
fieldbyname('GangFee').Value := Order_Sub.fieldbyname('GangFee').AsFloat;
fieldbyname('YunFee').Value := Order_Sub.fieldbyname('YunFee').AsFloat;
fieldbyname('OtherFee').Value := Order_Sub.fieldbyname('OtherFee').AsFloat;
fieldbyname('PRTCode').Value := Order_Sub.fieldbyname('PRTCode').AsString;
if Trim(fieldbyname('PRTPrice').AsString) = '' then
begin
fieldbyname('PRTPrice').Value := 0
end;
Post;
end;
Order_Sub.Edit;
Order_Sub.FieldByName('SubId').Value := Trim(maxno);
//Order_Sub.Post;
Next;
end;
Order_Sub.EnableControls;
end;
ADOCmd.Connection.CommitTrans;
Result := True;
except
Result := False;
Order_Sub.EnableControls;
ADOCmd.Connection.RollbackTrans;
Application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ', 0);
if GetLSNo(ADOTemp, maxno, 'JS', 'JYOrder_Sub', 4, 1) = False then
begin
end;
end;
end;
procedure TfrmOrderInPut.TBSaveClick(Sender: TObject);
var
forderNo: string;
begin
OrdDate.SetFocus;
{ if Trim(OrderNo.Text)='' then
begin
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>Ų<EFBFBD><C5B2><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>','<27><>ʾ',0);
Exit;
end; }
if Trim(CustomerNoName.Text) = '' then
begin
Application.MessageBox('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD>Ʋ<EFBFBD><C6B2><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>', '<27><>ʾ', 0);
Exit;
end;
if Trim(orderType.Text) = '' then
begin
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ͳ<EFBFBD><CDB2><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>', '<27><>ʾ', 0);
Exit;
end;
if Order_Sub.Locate('PRTCodeName', null, []) = True then
begin
Application.MessageBox('Ʒ<><C6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
Exit;
end;
if Order_Sub.Locate('PRTCodeName', '', []) = True then
begin
Application.MessageBox('Ʒ<><C6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
Exit;
end;
if Order_Sub.Locate('PRTColor', null, []) = True then
begin
Application.MessageBox('<27><>ɫ<EFBFBD><C9AB><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
Exit;
end;
if Order_Sub.Locate('PRTColor', '', []) = True then
begin
Application.MessageBox('<27><>ɫ<EFBFBD><C9AB><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
Exit;
end;
if Order_Sub.Locate('PRTPrice', null, []) = True then
begin
Application.MessageBox('<27>۸<EFBFBD><DBB8><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
Exit;
end;
// IF trim(orderType.Text)='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then
// begin
// IF trim(OrdPerson1.Text)='' then
// begin
// application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ҵ<EFBFBD><D2B5>Ա<EFBFBD><D4B1><EFBFBD><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>','<27><>ʾ',0);
// exit;
// end;
// end;
{ if Order_Sub.Locate('PRTPrice','',[])=True then
begin
Application.MessageBox('<27>۸<EFBFBD><DBB8><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!','<27><>ʾ',0);
Exit;
end; }
{ with Order_Sub do
begin
DisableControls;
First;
while not eof do
begin
if (fieldbyname('PRTRollNum').AsFloat=0) and (fieldbyname('PRTOrderQty').AsFloat=0)then
begin
EnableControls;
application.MessageBox('ƥ<><C6A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͬʱδ<CAB1>㣡','<27><>ʾ<EFBFBD><CABE>Ϣ',0);
exit;
end;
next;
end;
First;
EnableControls;
end;
}
with ADOTemp do
begin
Close;
sql.Clear;
sql.Add('select * from KH_Zdy_Attachment where zdyName=''' + Trim(CustomerNoName.Text) + '''');
Open;
end;
if ADOTemp.IsEmpty then
begin
Application.MessageBox('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
Exit;
end;
if PState = 1 then
begin
if trim(orddefnote1.Text) = '' then
begin
Application.MessageBox('<27>޸ı<DEB8>ע<EFBFBD><D7A2>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
Exit;
end;
end;
if Order_Sub.IsEmpty then
begin
Application.MessageBox('<27><>ϸ<EFBFBD><CFB8><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
Exit;
end;
if PState = 1 then
begin
if Trim(OrderNo.Text) <> Trim(forderNo) then
begin
with ADOTemp do
begin
Close;
sql.Clear;
sql.Add('select * from YF_Money_CR where MainId=''' + Trim(FMainId) + '''');
Open;
end;
if ADOTemp.IsEmpty = False then
begin
Application.MessageBox('<27>Ѳ<EFBFBD><D1B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD><DDA3><EFBFBD><EFBFBD>ܸ<EFBFBD><DCB8>Ķ<EFBFBD><C4B6><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
Exit;
end;
end;
end
else
begin
if trim(fSYRName) = '<27><><EFBFBD>˷<EFBFBD>֯' then
begin
if GetLSNo(ADOCmd, forderNo, 'L', 'JYOrder_Main', 3, 1) = False then
begin
Application.MessageBox(<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>!', '<27><>ʾ', 0);
Exit;
end;
end
else
begin
if trim(orderType.Text) = '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then
begin
if GetLSNo(ADOCmd, forderNo, 'J', 'JYOrder_Main', 3, 1) = False then
begin
Application.MessageBox(<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>!', '<27><>ʾ', 0);
Exit;
end;
end
else if trim(orderType.Text) = '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then
begin
if GetLSNo(ADOCmd, forderNo, 'B', 'JYOrder_Main', 4, 1) = False then
begin
Application.MessageBox(<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>!', '<27><>ʾ', 0);
Exit;
end;
end
else
begin
if GetLSNo(ADOCmd, forderNo, '', 'JYOrder_Main', 3, 1) = False then
begin
Application.MessageBox(<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>!', '<27><>ʾ', 0);
Exit;
end;
end;
end;
OrderNo.text := trim(forderNo);
end;
if SaveData() then
begin
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>', '<27><>ʾ', 0);
if PState = 0 then
begin
FMainId := '';
SClearData(ScrollBox1, 2);
if trim(fsyrName) <> '' then
begin
SYRName.Items.Clear;
SYRName.Items.Add(fsyrName);
SYRName.ItemIndex := 0;
SYRName.Enabled := false;
end;
orderType.ItemIndex := 0;
InitData();
Label29.Caption := '<27><><EFBFBD>ۣ<EFBFBD>';
Label22.Caption := <><C6A5><EFBFBD><EFBFBD>';
Label23.Caption := '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
Note.Text := '';
end
else
ModalResult := 1;
end;
end;
procedure TfrmOrderInPut.v1PRTColorPropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
begin
try
frmZdyAttachCP := TfrmZdyAttachCP.Create(Application);
with frmZdyAttachCP do
begin
if ShowModal = 1 then
begin
Self.Order_Sub.Edit;
Self.Order_Sub.FieldByName('PRTCode').Value := Trim(CDS_HZ.fieldbyname('ZdyCode').AsString);
Self.Order_Sub.FieldByName('PRTCodeName').Value := Trim(CDS_HZ.fieldbyname('ZDYName').AsString);
Self.Order_Sub.FieldByName('PRTColor').Value := Trim(CDS_HZ.fieldbyname('DEFstr3').AsString);
// Self.Order_Sub.FieldByName('SOrddefstr4').Value:=Trim(ClientDataSet1.fieldbyname('Note').AsString);
Self.Order_Sub.Post;
end;
end;
finally
frmZdyAttachCP.Free;
end;
self.tv1.Controller.EditingController.ShowEdit();
end;
procedure TfrmOrderInPut.ToolButton1Click(Sender: TObject);
var
i: Integer;
begin
if Trim(OrderNo.Text) = '' then
begin
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>Ų<EFBFBD><C5B2><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
Exit;
end;
i := Order_Sub.RecordCount;
i := i + 1;
CopyAddRow(Tv1, Order_Sub);
with Order_Sub do
begin
Edit;
FieldByName('XHNO').Value := IntToStr(i);
FieldByName('OrderUnit').Value := '<27><>';
{ if i<9 then
FieldByName('SOrddefstr1').Value:='0'+Trim(IntToStr(i))
else
FieldByName('SOrddefstr1').Value:=Trim(IntToStr(i));
FieldByName('PRTColor').Value:='';
FieldByName('PRTOrderQty').Value:=null;
//FieldByName('PRTPrice').Value:=null;
// FieldByName('SOrddefstr1').Value:=null;
FieldByName('SOrddefstr2').Value:=null; }
Post;
end;
end;
procedure TfrmOrderInPut.ToolButton2Click(Sender: TObject);
begin
if Order_Sub.IsEmpty then
Exit;
{ with ADOTemp do
begin
Close;
sql.Clear;
sql.Add('select * from Contract_Cloth_LLMX where OrdSubId='''+Trim(Order_Sub.fieldbyname('SubId').AsString)+'''');
Open;
end;
if ADOTemp.IsEmpty=False then
begin
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ϲ<EFBFBD><CFB2><EFBFBD>ɾ<EFBFBD><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!','<27><>ʾ',0);
Exit;
end;
with ADOTemp do
begin
Close;
sql.Clear;
sql.Add('select * from JYOrder_Sub_AnPai where SubId='''+Trim(Order_Sub.fieldbyname('SubId').AsString)+'''');
Open;
end;
if ADOTemp.IsEmpty=False then
begin
Application.MessageBox('<27>ѻزֲ<D8B2><D6B2><EFBFBD>ɾ<EFBFBD><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!','<27><>ʾ',0);
Exit;
end; }
if Trim(Order_Sub.fieldbyname('SubId').AsString) <> '' then
begin
if Application.MessageBox(<><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
Exit;
with ADOTemp do
begin
close;
sql.Clear;
sql.Add('update CK_BanCP_KC SET BHFlag=0 ');
sql.Add('where BHOrderNo=' + quotedstr(trim(FMainId)));
sql.Add('and C_CodeName=' + quotedstr(trim(Order_Sub.fieldbyname('PRTCodeName').asstring)));
sql.Add('and C_Color=' + quotedstr(trim(Order_Sub.fieldbyname('PRTColor').asstring)));
// sql.Add('where mainID=' + quotedstr(trim(Order_Sub.fieldbyname('mainID').asstring)));
// sql.Add('and subID=' + quotedstr(trim(Order_Sub.fieldbyname('subID').asstring)));
// sql.Add('where CRID=' + quotedstr(trim(CDS_PH.fieldbyname('CRID').AsString)));
// sql.Add('delete from CK_BanCP_BH where PHID=''' + trim(CDS_PH.fieldbyname('PHID').AsString) + ''' ');
execsql;
end;
with ADOTemp do
begin
Close;
sql.Clear;
sql.Add('select * from YF_Money_CR where subID=''' + Trim(Order_Sub.fieldbyname('SubId').AsString) + ''' and CRType='<>տ<EFBFBD><D5BF>Ǽ<EFBFBD>''');
Open;
end;
if ADOTemp.IsEmpty = False then
begin
Application.MessageBox('<27>Ѳ<EFBFBD><D1B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD><DDA3><EFBFBD><EFBFBD>ܸ<EFBFBD><DCB8>Ķ<EFBFBD><C4B6><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
Exit;
end;
{ with ADOCmd do
begin
Close;
sql.Clear;
sql.Add('delete JYOrder_Sub where SubId='''+Trim(Order_Sub.fieldbyname('SubId').AsString)+'''');
ExecSQL;
end; }
end;
Order_Sub.Delete;
end;
procedure TfrmOrderInPut.JGFactoryNameBtnUpClick(Sender: TObject);
begin
try
frmZDYHelp := TfrmZDYHelp.Create(Application);
with frmZDYHelp do
begin
flag := 'RKPlace';
flagname := <><C8BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
if ShowModal = 1 then
begin
JGFactoryName.Text := Trim(ClientDataSet1.fieldbyname('ZDYName').AsString);
JGFactoryName.TxtCode := Trim(ClientDataSet1.fieldbyname('ZDYNo').AsString);
end;
end;
finally
frmZDYHelp.Free;
end;
end;
procedure TfrmOrderInPut.CustomerNoNameBtnUpClick(Sender: TObject);
begin
{ try
frmZDYHelp:=TfrmZDYHelp.Create(Application);
with frmZDYHelp do
begin
flag:='KHName';
flagname:='<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>';
if Trim(DParameters1)<>'<27><>Ȩ<EFBFBD><C8A8>' then
MainType:=Trim(DName);
if ShowModal=1 then
begin
CustomerNoName.Text:=Trim(ClientDataSet1.fieldbyname('ZDYName').AsString);
CustomerNoName.TxtCode:=Trim(ClientDataSet1.fieldbyname('ZDYNo').AsString);
end;
end;
finally
frmZDYHelp.Free;
end; }
CustomerNoName.OnChange := nil;
try
frmZdyAttachment := TfrmZdyAttachment.Create(Application);
with frmZdyAttachment do
begin
fkhType := '';
{ if trim(fCustomerNoName)='<27><EFBFBD><E3B6AB><EFBFBD>в<EFBFBD>' then
begin
fkhType:='<27><EFBFBD>ͻ<EFBFBD>';
end
else
begin
fkhType:=self.fsyrName;
end; }
if trim(SYRName.Text) = '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֯' then
begin
fkhType := '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֯';
end
else if trim(SYRName.Text) = 'һ<>׷<EFBFBD>֯' then
begin
fkhType := 'һ<>׷<EFBFBD>֯';
end
else if trim(SYRName.Text) = '<27><><EFBFBD>·<EFBFBD>֯' then
begin
fkhType := '<27><><EFBFBD>·<EFBFBD>֯';
end
else
fkhType := self.fsyrName;
if ShowModal = 1 then
begin
CustomerNoName.Text := Trim(CDS_HZ.fieldbyname('ZDYName').AsString);
CustomerNoName.TxtCode := Trim(CDS_HZ.fieldbyname('ZdyCode').AsString);
FHAddress.Text := Trim(CDS_HZ.fieldbyname('DEFNote2').AsString);
LXFS.Text := Trim(CDS_HZ.fieldbyname('DEFstr2').AsString);
OrdPerson1.Text := Trim(CDS_HZ.fieldbyname('DEFstr5').AsString);
end;
end;
finally
frmZdyAttachment.Free;
end;
CustomerNoName.OnChange := CustomerNoNameChange;
end;
procedure TfrmOrderInPut.CustomerNoNameBtnDnClick(Sender: TObject);
begin
TBtnEditC(Sender).Text := '';
TBtnEditC(Sender).TxtCode := '';
end;
procedure TfrmOrderInPut.v1Column1PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
type
TMyFunc = function(App: Tapplication; FormH: hwnd; FormID: integer; Language: integer; WinStyle: integer; GCode: Pchar; GName: Pchar; DataBase: Pchar; Title: PChar; Parameters1: PChar; Parameters2: PChar; Parameters3: PChar; Parameters4: PChar; Parameters5: PChar; Parameters6: PChar; Parameters7: PChar; Parameters8: PChar; Parameters9: PChar; Parameters10: PChar; DataBaseStr: PChar): hwnd; stdcall;
var
Tf: TMyFunc;
Tp: TFarProc;
Th: Thandle;
LabInt, labname: string;
begin
//if PPInt=2 then Exit;
Ddatabase := StringOfChar(' ', 32);
Th := LoadLibrary('LabelSet.dll');
if Th > 0 then
begin
try
Tp := GetProcAddress(Th, 'GetDllForm');
if Tp <> nil then
begin
Tf := TMyFunc(Tp);
newh := Tf(Application, 0, 2, 0, 0, PChar(DCode), PChar(DName), PChar(Ddatabase), PChar('<27><>ǩģ<C7A9><C4A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'), PChar(''), PChar(''), '', '', '', '', '', '', '', '', PChar(DConString));
if Trim(PChar(Ddatabase)) <> '' then
begin
Ddatabase := Trim(PChar(Ddatabase));
LabInt := Trim(LeftBStr(Ddatabase, Pos('|', Ddatabase) - 1));
labname := Trim(RightBStr(Ddatabase, Length(Ddatabase) - Pos('|', Ddatabase)));
with Order_Sub do
begin
Edit;
FieldByName('SLbName').Value := labname;
FieldByName('SLbInt').Value := LabInt;
end;
end;
end
else
begin
ShowMessage('<27><>ӡִ<D3A1>д<EFBFBD><D0B4><EFBFBD>');
end;
finally
// FreeLibrary();
end;
end
else
begin
ShowMessage('<27>Ҳ<EFBFBD><D2B2><EFBFBD>' + Trim('LabelSet.dll'));
end;
end;
procedure TfrmOrderInPut.OrdDefStr3BtnUpClick(Sender: TObject);
begin
try
frmZDYHelpSel := TfrmZDYHelpSel.Create(Application);
with frmZDYHelpSel do
begin
flag := 'maitou';
flagname := '<27><>ͷ';
if ShowModal = 1 then
begin
OrdDefStr3.Text := OrdDefStr3.Text + frmZDYHelpSel.ReturnStr;
end;
end;
finally
frmZDYHelpSel.Free;
end;
end;
procedure TfrmOrderInPut.MPRTCodeNameBtnUpClick(Sender: TObject);
begin
try
frmZDYHelp := TfrmZDYHelp.Create(Application);
with frmZDYHelp do
begin
flag := 'MPRTCodeName';
flagname := '<27><>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>';
if ShowModal = 1 then
begin
MPRTCodeName.Text := Trim(ClientDataSet1.fieldbyname('ZDYName').AsString);
MPRTCodeName.TxtCode := Trim(ClientDataSet1.fieldbyname('ZDYNo').AsString);
end;
end;
finally
frmZDYHelp.Free;
end;
end;
procedure TfrmOrderInPut.NoteDblClick(Sender: TObject);
begin
try
frmZDYHelpSel := TfrmZDYHelpSel.Create(Application);
with frmZDYHelpSel do
begin
flag := 'OrdNote';
flagname := '<27><>ע<EFBFBD><D7A2>Ҫ<EFBFBD><D2AA>';
if ShowModal = 1 then
begin
Note.Text := Note.Text + frmZDYHelpSel.ReturnStr;
end;
end;
finally
frmZDYHelpSel.Free;
end;
end;
procedure TfrmOrderInPut.v1OrderUnitPropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
begin
try
frmZDYHelp := TfrmZDYHelp.Create(Application);
with frmZDYHelp do
begin
flag := 'OrderUnit';
flagname := '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ';
if ShowModal = 1 then
begin
Self.Order_Sub.Edit;
Self.Order_Sub.FieldByName('OrderUnit').Value := Trim(ClientDataSet1.fieldbyname('ZDYName').AsString);
end;
end;
finally
frmZDYHelp.Free;
end;
end;
procedure TfrmOrderInPut.v1PriceUnitPropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
begin
try
frmZDYHelp := TfrmZDYHelp.Create(Application);
with frmZDYHelp do
begin
flag := 'PriceUnit';
flagname := '<27>۸<EFBFBD><DBB8><EFBFBD>λ';
if ShowModal = 1 then
begin
Self.Order_Sub.Edit;
Self.Order_Sub.FieldByName('PriceUnit').Value := Trim(ClientDataSet1.fieldbyname('ZDYName').AsString);
end;
end;
finally
frmZDYHelp.Free;
end;
end;
procedure TfrmOrderInPut.jKeyPress(Sender: TObject; var Key: Char);
begin
if Key = #13 then
begin
with ADOTemp do
begin
Close;
sql.Clear;
sql.Add('select * from CP_YDang where CYNo like ''' + '%' + Trim(OrdDefStr1.Text) + '%' + '''');
Open;
end;
if ADOTemp.RecordCount = 1 then
begin
MPRTCodeName.Text := Trim(ADOTemp.fieldbyname('CYName').AsString);
MPRTCF.Text := Trim(ADOTemp.fieldbyname('CYECF').AsString);
MPRTSpec.Text := Trim(ADOTemp.fieldbyname('CYSpec').AsString);
MPRTMF.Text := Trim(ADOTemp.fieldbyname('CYMF').AsString);
MPRTKZ.Text := Trim(ADOTemp.fieldbyname('CYKZ').AsString);
end
else if ADOTemp.RecordCount > 1 then
begin
with ADOTemp do
begin
Close;
sql.Clear;
sql.Add('select * from CP_YDang where CYNo=''' + Trim(OrdDefStr1.Text) + '''');
Open;
end;
if ADOTemp.RecordCount = 1 then
begin
MPRTCodeName.Text := Trim(ADOTemp.fieldbyname('CYName').AsString);
MPRTCF.Text := Trim(ADOTemp.fieldbyname('CYECF').AsString);
MPRTSpec.Text := Trim(ADOTemp.fieldbyname('CYSpec').AsString);
MPRTMF.Text := Trim(ADOTemp.fieldbyname('CYMF').AsString);
MPRTKZ.Text := Trim(ADOTemp.fieldbyname('CYKZ').AsString);
end;
end;
end;
end;
procedure TfrmOrderInPut.OrdDefStr2BtnUpClick(Sender: TObject);
var
fsj: string;
FWZ: Integer;
begin
fsj := Trim(TEdit(Sender).Hint);
FWZ := Pos('/', fsj);
try
frmZDYHelp := TfrmZDYHelp.Create(Application);
with frmZDYHelp do
begin
flag := Copy(fsj, 1, FWZ - 1);
flagname := Copy(fsj, FWZ + 1, Length(fsj) - FWZ);
if Trim(flag) = 'OrdDefStr2' then
begin
//flag:='OrdDefStr2';
V1Name.Caption := '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
V1Note.Caption := <><D3A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
fnote := True;
end;
if ShowModal = 1 then
begin
TEdit(Sender).Text := Trim(ClientDataSet1.fieldbyname('ZDYName').AsString);
end;
end;
finally
frmZDYHelp.Free;
end;
end;
procedure TfrmOrderInPut.ConNoKeyPress(Sender: TObject; var Key: Char);
var
ConMainId: string;
begin
if Key = #13 then
begin
with ADOTemp do
begin
Close;
sql.Clear;
sql.Add('select * from JYOrderCon_Main where ConNo like ''' + '%' + Trim(ConNo.Text) + '%' + '''');
Open;
end;
if ADOTemp.RecordCount > 1 then
begin
with ADOTemp do
begin
Close;
sql.Clear;
sql.Add('select Top 1* from JYOrderCon_Main where ConNo=''' + Trim(ConNo.Text) + '''');
Open;
end;
if ADOTemp.IsEmpty then
Exit;
end
else if ADOTemp.RecordCount = 1 then
begin
with ADOTemp do
begin
Close;
sql.Clear;
sql.Add('select * from JYOrderCon_Main where ConNo like ''' + '%' + Trim(ConNo.Text) + '%' + '''');
Open;
end;
end;
begin
ConNo.Text := Trim(ADOTemp.fieldbyname('ConNo').AsString);
OrdDefStr1.Text := Trim(ADOTemp.fieldbyname('ConDefStr1').AsString);
MPRTCF.Text := Trim(ADOTemp.fieldbyname('MPRTCF').AsString);
MPRTSpec.Text := Trim(ADOTemp.fieldbyname('MPRTSpec').AsString);
MPRTMF.Text := Trim(ADOTemp.fieldbyname('MPRTMF').AsString);
MPRTKZ.Text := Trim(ADOTemp.fieldbyname('MPRTKZ').AsString);
CustomerNoName.Text := Trim(ADOTemp.fieldbyname('CustomerNoName').AsString);
CustomerNoName.TxtCode := Trim(ADOTemp.fieldbyname('CustomerNo').AsString);
ConMainId := Trim(ADOTemp.fieldbyname('MainId').AsString);
// ConGS:=Trim(ADOTemp.fieldbyname('SYRName').AsString);
OrdDefStr2.Text := Trim(ADOTemp.fieldbyname('ConDefStr2').AsString);
with ADOTemp do
begin
Close;
sql.Clear;
sql.Add('select A.*,ColorName=(select ZdyName from KH_Zdy B where B.Note=A.PRTColor and B.Type=''OrdColor'' ) ');
SQL.Add(' from JYOrderCon_Sub A where MainId=''' + Trim(ConMainId) + '''');
Open;
end;
with ADOTemp do
begin
First;
while not Eof do
begin
with Order_Sub do
begin
Append;
FieldByName('PRTColor').Value := Trim(ADOTemp.fieldbyname('PRTColor').AsString);
FieldByName('SOrdDefStr4').Value := Trim(ADOTemp.fieldbyname('SOrdDefStr4').AsString);
FieldByName('SOrdDefStr3').Value := Trim(ADOTemp.fieldbyname('SOrdDefStr3').AsString);
FieldByName('PRTOrderQty').Value := Trim(ADOTemp.fieldbyname('PRTOrderQty').AsString);
FieldByName('OrderUnit').Value := Trim(ADOTemp.fieldbyname('OrderUnit').AsString);
FieldByName('PRTPrice').Value := Trim(ADOTemp.fieldbyname('PRTPrice').AsString);
FieldByName('PriceUnit').Value := Trim(ADOTemp.fieldbyname('PriceUnit').AsString);
FieldByName('PRTHX').Value := Trim(ADOTemp.fieldbyname('PRTHX').AsString);
FieldByName('XHNO').Value := Trim(ADOTemp.fieldbyname('XHNO').AsString);
Post;
end;
Next;
end;
end;
with ADOTemp do
begin
Close;
sql.Clear;
sql.Add('select Top 1* from CP_YDang where CYNO=''' + Trim(OrdDefStr1.Text) + '''');
Open;
end;
MPRTCodeName.Text := Trim(ADOTemp.fieldbyname('CYName').AsString);
{with ADOTemp do
begin
Close;
sql.Clear;
sql.Add('select Top 1* from KH_Zdy where Note='''+Trim(ConGS)+''' and type=''OrdDefStr2'' ');
Open;
end;
OrdDefStr2.Text:=Trim(ADOTemp.fieldbyname('ZdyName').AsString); }
end;
end;
end;
procedure TfrmOrderInPut.ToolButton3Click(Sender: TObject);
begin
if Order_Sub.IsEmpty then
Exit;
OneKeyPost(Tv1, Order_Sub);
end;
procedure TfrmOrderInPut.v1Column6PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
begin
try
frmZDYHelp := TfrmZDYHelp.Create(Application);
with frmZDYHelp do
begin
flag := 'MPRTMF';
flagname := '<27>ŷ<EFBFBD>';
V1Name.Caption := '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
V1Note.Caption := <><D3A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
// MainType:=Trim(DName);
fnote := FALSE;
if ShowModal = 1 then
begin
Self.Order_Sub.Edit;
Self.Order_Sub.FieldByName('PRTMF').Value := Trim(ClientDataSet1.fieldbyname('ZDYName').AsString);
// Self.Order_Sub.FieldByName('SOrddefstr4').Value:=Trim(ClientDataSet1.fieldbyname('Note').AsString);
Self.Order_Sub.Post;
end;
end;
finally
frmZDYHelp.Free;
end;
self.tv1.Controller.EditingController.ShowEdit();
end;
procedure TfrmOrderInPut.v1Column8PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
begin
try
frmZDYHelp := TfrmZDYHelp.Create(Application);
with frmZDYHelp do
begin
flag := 'MPRTKZ';
flagname := '<27><><EFBFBD><EFBFBD>';
V1Name.Caption := '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
V1Note.Caption := <><D3A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
// MainType:=Trim(DName);
fnote := FALSE;
if ShowModal = 1 then
begin
Self.Order_Sub.Edit;
Self.Order_Sub.FieldByName('PRTKZ').Value := Trim(ClientDataSet1.fieldbyname('ZDYName').AsString);
// Self.Order_Sub.FieldByName('SOrddefstr4').Value:=Trim(ClientDataSet1.fieldbyname('Note').AsString);
Self.Order_Sub.Post;
end;
end;
finally
frmZDYHelp.Free;
end;
self.tv1.Controller.EditingController.ShowEdit();
end;
procedure TfrmOrderInPut.v1Column5PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
begin
with ADOTemp do
begin
Close;
sql.Clear;
Filtered := False;
SQL.Add('select case when isnull(PHSL,0)=0 then B.KCQty else phsl end as PHSL ,');
sql.Add('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,B.BHFlag ');
sql.Add('from CK_BanCP_BH 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_Sub.fieldbyname('mainID').asstring)));
sql.Add('and A.subID=' + quotedstr(trim(Order_Sub.fieldbyname('subID').asstring)));
sql.Add('order by A.phID ');
open;
end;
if not ADOTemp.IsEmpty then
begin
application.MessageBox('<27>õ<EFBFBD><C3B5>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˣ<EFBFBD><CBA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>޸IJ<DEB8>Ʒ<EFBFBD><C6B7><EFBFBD>ƣ<EFBFBD><C6A3><EFBFBD><EFBFBD><EFBFBD>ɾ<EFBFBD><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD><DDA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
with Order_Sub do
begin
Edit;
FieldByName('PRTCodeName').Value := trim(ADOTemp.fieldbyname('C_CodeName').AsString);
Post;
end;
end
else
begin
try
frmZdyAttachCP := TfrmZdyAttachCP.Create(Application);
with frmZdyAttachCP do
begin
FType := '<27><>Ʒ';
if ShowModal = 1 then
begin
Self.Order_Sub.Edit;
Self.Order_Sub.FieldByName('PRTCode').Value := Trim(CDS_HZ.fieldbyname('ZdyCode').AsString);
Self.Order_Sub.FieldByName('PRTCodeName').Value := Trim(CDS_HZ.fieldbyname('ZDYName').AsString);
Self.Order_Sub.FieldByName('PRTColor').Value := Trim(CDS_HZ.fieldbyname('DEFstr3').AsString);
// Self.Order_Sub.FieldByName('SOrddefstr4').Value:=Trim(ClientDataSet1.fieldbyname('Note').AsString);
Self.Order_Sub.Post;
end;
end;
finally
frmZdyAttachCP.Free;
end;
with ADOQueryCP do
begin
close;
sql.Clear;
sql.Add('select ATID,defstr3 from KH_Zdy_Attachment A ');
sql.Add('where zdyName=' + quotedstr(trim(Order_Sub.fieldbyname('PRTCodeName').AsString)));
open;
end;
end;
{ try
frmZDYHelp:=TfrmZDYHelp.Create(Application);
with frmZDYHelp do
begin
flag:='CP';
flagname:='<27><>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>';
V1Name.Caption:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
V1Note.Caption:='Ӣ<><D3A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
// MainType:=Trim(DName);
fnote:=FALSE;
if ShowModal=1 then
begin
Self.Order_Sub.Edit;
Self.Order_Sub.FieldByName('PRTCode').Value:=Trim(ClientDataSet1.fieldbyname('ZDYNo').AsString);
Self.Order_Sub.FieldByName('PRTCodeName').Value:=Trim(ClientDataSet1.fieldbyname('ZDYName').AsString)+'#';
// Self.Order_Sub.FieldByName('SOrddefstr4').Value:=Trim(ClientDataSet1.fieldbyname('Note').AsString);
Self.Order_Sub.Post;
end;
end;
finally
frmZDYHelp.Free;
end; }
self.tv1.Controller.EditingController.ShowEdit();
end;
procedure TfrmOrderInPut.v1Column7PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
begin
try
frmZDYHelp := TfrmZDYHelp.Create(Application);
with frmZDYHelp do
begin
flag := 'MPRTSpec';
flagname := '<27><><EFBFBD><EFBFBD>';
V1Name.Caption := '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
V1Note.Caption := <><D3A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
// MainType:=Trim(DName);
fnote := FALSE;
if ShowModal = 1 then
begin
Self.Order_Sub.Edit;
// Self.Order_Sub.FieldByName('PRTCode').Value:=Trim(ClientDataSet1.fieldbyname('ZDYCode').AsString);
Self.Order_Sub.FieldByName('PRTSpec').Value := Trim(ClientDataSet1.fieldbyname('ZDYName').AsString);
// Self.Order_Sub.FieldByName('SOrddefstr4').Value:=Trim(ClientDataSet1.fieldbyname('Note').AsString);
Self.Order_Sub.Post;
end;
end;
finally
frmZDYHelp.Free;
end;
self.tv1.Controller.EditingController.ShowEdit();
end;
procedure TfrmOrderInPut.FHAddressBtnUpClick(Sender: TObject);
begin
if Trim(CustomerNoName.Text) = '' then
begin
Application.MessageBox('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
Exit;
end;
try
frmZDYHelpSel := TfrmZDYHelpSel.Create(Application);
with frmZDYHelpSel do
begin
flag := 'FHAddress';
flagname := '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ';
MainType := Trim(CustomerNoName.Text);
if ShowModal = 1 then
begin
FHAddress.Text := Trim(ReturnStr);
end;
end;
finally
frmZDYHelpSel.Free;
end;
end;
procedure TfrmOrderInPut.LXFSBtnUpClick(Sender: TObject);
begin
if Trim(CustomerNoName.Text) = '' then
begin
Application.MessageBox('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
Exit;
end;
try
frmZDYHelpSel := TfrmZDYHelpSel.Create(Application);
with frmZDYHelpSel do
begin
flag := 'LXFS';
flagname := '<27><>ϵ<EFBFBD><CFB5>ʽ';
MainType := Trim(CustomerNoName.Text);
if ShowModal = 1 then
begin
LXFS.Text := Trim(ReturnStr);
end;
end;
finally
frmZDYHelpSel.Free;
end;
end;
procedure TfrmOrderInPut.v1Column5PropertiesEditValueChanged(Sender: TObject);
var
mvalue: string;
begin
mvalue := TcxTextEdit(Sender).EditingText;
if trim(mvalue) = '' then
exit;
if rightBstr(trim(mvalue), 1) <> '#' then
begin
mvalue := trim(mvalue) + '#';
end;
with Order_Sub do
begin
Edit;
FieldByName('PRTCodeName').Value := Trim(mvalue);
Post;
end;
self.tv1.Controller.EditingController.ShowEdit();
DoKc();
with ADOTemp do
begin
Close;
sql.Clear;
Filtered := False;
SQL.Add('select case when isnull(PHSL,0)=0 then B.KCQty else phsl end as PHSL ,');
sql.Add('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,B.BHFlag ');
sql.Add('from CK_BanCP_BH 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_Sub.fieldbyname('mainID').asstring)));
sql.Add('and A.subID=' + quotedstr(trim(Order_Sub.fieldbyname('subID').asstring)));
sql.Add('order by A.phID ');
open;
end;
if not ADOTemp.IsEmpty then
begin
application.MessageBox('<27>õ<EFBFBD><C3B5>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˣ<EFBFBD><CBA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>޸IJ<DEB8>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɾ<EFBFBD><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD><DDA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
with Order_Sub do
begin
Edit;
FieldByName('PRTCodeName').Value := trim(ADOTemp.fieldbyname('C_CodeName').AsString);
Post;
end;
end;
with ADOTemp do
begin
close;
sql.Clear;
sql.Add('select * from KH_Zdy_Attachment A ');
sql.Add('where zdyName=' + quotedstr(trim(Order_Sub.fieldbyname('PRTCodeName').AsString)));
open;
end;
if ADOTemp.IsEmpty then
begin
application.MessageBox('Ʒ<><C6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
with Order_Sub do
begin
Edit;
FieldByName('PRTCodeName').Value := '';
Post;
end;
exit;
end;
(v1PRTColor.Properties as TcxComboBoxProperties).Items.Clear;
while not ADOTemp.Eof do
begin
(v1PRTColor.Properties as TcxComboBoxProperties).Items.Add(ADOTemp.fieldbyname('defstr3').AsString);
ADOTemp.Next;
end;
with ADOQueryCP do
begin
close;
sql.Clear;
sql.Add('select ATID,defstr3 from KH_Zdy_Attachment A ');
sql.Add('where zdyName=' + quotedstr(trim(Order_Sub.fieldbyname('PRTCodeName').AsString)));
open;
end;
end;
procedure TfrmOrderInPut.v1PRTColorPropertiesEditValueChanged(Sender: TObject);
var
mvalue: string;
begin
mvalue := TcxTextEdit(Sender).EditingText;
if trim(mvalue) = '' then
exit;
if rightBstr(trim(mvalue), 1) <> '#' then
begin
mvalue := trim(mvalue) + '#';
end;
with Order_Sub do
begin
Edit;
FieldByName('PRTColor').Value := Trim(mvalue);
Post;
end;
self.tv1.Controller.EditingController.ShowEdit();
DoKc();
with ADOTemp do
begin
Close;
sql.Clear;
Filtered := False;
SQL.Add('select case when isnull(PHSL,0)=0 then B.KCQty else phsl end as PHSL ,');
sql.Add('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,B.BHFlag ');
sql.Add('from CK_BanCP_BH 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_Sub.fieldbyname('mainID').asstring)));
sql.Add('and A.subID=' + quotedstr(trim(Order_Sub.fieldbyname('subID').asstring)));
sql.Add('order by A.phID ');
open;
end;
if not ADOTemp.IsEmpty then
begin
application.MessageBox('<27>õ<EFBFBD><C3B5>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˣ<EFBFBD><CBA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>޸<EFBFBD><DEB8><EFBFBD>ɫ<EFBFBD><C9AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɾ<EFBFBD><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD><DDA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
with Order_Sub do
begin
Edit;
FieldByName('PRTColor').Value := trim(ADOTemp.fieldbyname('C_Color').AsString);
Post;
end;
end;
with ADOTemp do
begin
close;
sql.Clear;
sql.Add('select * from KH_Zdy_Attachment A ');
sql.Add('where zdyName=' + quotedstr(trim(Order_Sub.fieldbyname('PRTCodeName').AsString)));
sql.Add('and DEFstr3=' + quotedstr(trim(Order_Sub.fieldbyname('PRTColor').AsString)));
open;
end;
if ADOTemp.IsEmpty then
begin
application.MessageBox('<27><>ɫ<EFBFBD><C9AB><EFBFBD><EFBFBD><EFBFBD>ڣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
with Order_Sub do
begin
Edit;
FieldByName('PRTColor').Value := '';
Post;
end;
end;
self.tv1.Controller.EditingController.ShowEdit();
end;
procedure TfrmOrderInPut.Tv1FocusedRecordChanged(Sender: TcxCustomGridTableView; APrevFocusedRecord, AFocusedRecord: TcxCustomGridRecord; ANewItemRecordFocusingChanged: Boolean);
begin
DoKc();
end;
procedure TfrmOrderInPut.OrdPerson1BtnClick(Sender: TObject);
begin
frmUserHelp := TfrmUserHelp.create(self);
with frmUserHelp do
begin
if showmodal = 1 then
begin
OrdPerson1.Text := trim(ADOQueryHelp.fieldbyname('UserName').AsString);
end;
free;
end;
end;
procedure TfrmOrderInPut.Button1Click(Sender: TObject);
var
i: Integer;
begin
if trim(edit1.Text) = '' then
exit;
with ADOCmd do
begin
close;
sql.Clear;
sql.Add('select * from KH_Zdy_Attachment A ');
sql.Add('where zdyName=' + quotedstr(trim(edit1.Text)));
open;
if IsEmpty then
begin
application.MessageBox('Ʒ<><C6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
exit;
end;
Order_Sub.DisableControls;
while not eof do
begin
Self.Order_Sub.Append;
Self.Order_Sub.FieldByName('XHNO').Value := Self.Order_Sub.RecordCount + 1;
Self.Order_Sub.FieldByName('OrderUnit').Value := '<27><>';
Self.Order_Sub.FieldByName('PRTCode').Value := Trim(fieldbyname('ZdyCode').AsString);
Self.Order_Sub.FieldByName('PRTCodeName').Value := Trim(fieldbyname('ZDYName').AsString);
Self.Order_Sub.FieldByName('PRTColor').Value := Trim(fieldbyname('DEFstr3').AsString);
Self.Order_Sub.FieldByName('PRTOrderQty').Value := strtofloatdef(trim(edit2.Text), 0);
Self.Order_Sub.FieldByName('PRTPrice').Value := strtofloatdef(trim(edit3.Text), 0);
Self.Order_Sub.post;
next;
end;
Order_Sub.First;
Order_Sub.EnableControls;
end;
self.tv1.Controller.EditingController.ShowEdit();
end;
procedure TfrmOrderInPut.OrdDateChange(Sender: TObject);
begin
if formatdateTime('yyyy-MM-dd', OrdDate.Date) > formatdateTime('yyyy-MM-dd', date()) then
begin
application.MessageBox('<27><><EFBFBD>ڲ<EFBFBD><DAB2>ܴ<EFBFBD><DCB4>ڽ<EFBFBD><DABD>죡', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
OrdDate.Date := strtodate(formatdateTime('yyyy-MM-dd', date()));
exit;
end;
end;
procedure TfrmOrderInPut.CustomerNoNameChange(Sender: TObject);
var
mvalue: string;
begin
mvalue := Trim(CustomerNoName.Text);
if Length(Trim(mvalue)) > 1 then
begin
//mvalue:='%'+Trim(mvalue)+'%';
with ADO_KH do
begin
Close;
sql.Clear;
sql.Add(' select * from KH_Zdy_Attachment ');
sql.Add(' where (ZDYName like ' + quotedstr('%' + trim(mvalue) + '%'));
sql.Add(' or dbo.getpinYin(zdyName) like ' + quotedstr('%' + trim(mvalue) + '%'));
sql.Add(' ) and isnull(khType,'''')=' + quotedstr(trim(fsyrName)));
sql.Add(' and Type=''KHName'' ');
Open;
end;
if ADO_KH.IsEmpty then
begin
cxGrid4.Visible := False;
CustomerNoName.text := '';
application.MessageBox('<27>ÿͻ<C3BF><CDBB>뵱ǰҵ<C7B0><D2B5>Ա<EFBFBD><D4B1>һ<EFBFBD>£<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
end
else
cxGrid4.Visible := True;
end;
end;
procedure TfrmOrderInPut.TV4CellDblClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
begin
CustomerNoName.OnChange := nil;
CustomerNoName.Text := Trim(ADO_KH.fieldbyname('ZDYName').AsString);
CustomerNoName.TxtCode := Trim(ADO_KH.fieldbyname('ZdyCode').AsString);
FHAddress.Text := Trim(ADO_KH.fieldbyname('DEFNote2').AsString);
LXFS.Text := Trim(ADO_KH.fieldbyname('DEFstr2').AsString);
OrdPerson1.Text := Trim(ADO_KH.fieldbyname('DEFstr5').AsString);
cxGrid4.Visible := False;
CustomerNoName.OnChange := CustomerNoNameChange;
end;
procedure TfrmOrderInPut.TV4KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
begin
if Key = VK_RETURN then
begin
CustomerNoName.OnChange := nil;
CustomerNoName.Text := Trim(ADO_KH.fieldbyname('ZDYName').AsString);
CustomerNoName.TxtCode := Trim(ADO_KH.fieldbyname('ZdyCode').AsString);
FHAddress.Text := Trim(ADO_KH.fieldbyname('DEFNote2').AsString);
LXFS.Text := Trim(ADO_KH.fieldbyname('DEFstr2').AsString);
OrdPerson1.Text := Trim(ADO_KH.fieldbyname('DEFstr5').AsString);
cxGrid4.Visible := False;
CustomerNoName.OnChange := CustomerNoNameChange;
end;
end;
procedure TfrmOrderInPut.CustomerNoNameKeyPress(Sender: TObject; var Key: Char);
begin
CustomerNoName.OnChange := CustomerNoNameChange;
if Key = #13 then
begin
CustomerNoName.OnChange := nil;
if (cxGrid4.Visible = true) and (not ADO_KH.IsEmpty) then
begin
CustomerNoName.OnChange := nil;
CustomerNoName.Text := Trim(ADO_KH.fieldbyname('ZDYName').AsString);
CustomerNoName.TxtCode := Trim(ADO_KH.fieldbyname('ZdyCode').AsString);
FHAddress.Text := Trim(ADO_KH.fieldbyname('DEFNote2').AsString);
LXFS.Text := Trim(ADO_KH.fieldbyname('DEFstr2').AsString);
OrdPerson1.Text := Trim(ADO_KH.fieldbyname('DEFstr5').AsString);
cxGrid4.Visible := False;
end;
with ADOTemp do
begin
close;
sql.Clear;
sql.Add('select DEFstr5 from KH_Zdy_Attachment where Type=''KHName'' ');
sql.Add('and zdyName like ''' + '%' + Trim(CustomerNoName.Text) + '%' + '''');
open;
end;
if Trim(OrdPerson1.text) <> Trim(ADOTemp.fieldbyname('DEFstr5').AsString) then
begin
CustomerNoName.text := '';
application.MessageBox('<27>ÿͻ<C3BF><CDBB>뵱ǰҵ<C7B0><D2B5>Ա<EFBFBD><D4B1>һ<EFBFBD>£<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
exit;
end;
end;
//CustomerNoName.OnChange:=CustomerNoNameChange;
// cxGrid4.Visible:=False;
end;
procedure TfrmOrderInPut.Tv1CellClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
begin
{ IF trim(Order_Sub.fieldbyname('PRTCodeName').AsString)<>'' then
begin
with ADOQueryCP do
begin
close;
sql.Clear;
sql.Add('select ATID,defstr3 from KH_Zdy_Attachment A ');
sql.Add('where zdyName='+quotedstr(trim(Order_Sub.fieldbyname('PRTCodeName').AsString)));
open;
end;
end;}
end;
end.