?? unit_productappend.pas
字號:
unit Unit_ProductAppend;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, cxGraphics, cxTextEdit, cxMaskEdit, cxDropDownEdit,
cxLookupEdit, cxDBLookupEdit, cxDBLookupComboBox, cxControls,
cxContainer, cxEdit, cxGroupBox, ComCtrls, DB, ADODB, StdCtrls,
cxCalendar, Buttons, cxCheckBox, cxLabel, cxRadioGroup;
type
TForm_ProductAppend = class(TForm)
PC_ProductAppend: TPageControl;
TS_ProductAttribute: TTabSheet;
LCB_ProductType: TcxLookupComboBox;
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
RG_ProductType: TcxRadioGroup;
RG_ProductLable: TcxRadioGroup;
CBK_NewLabel: TCheckBox;
LCB_ProductLabel: TcxLookupComboBox;
CBK_LabelForSupply: TcxCheckBox;
LCB_ProductSupply: TcxLookupComboBox;
TE_ProductNumber: TcxTextEdit;
RG_GB_UnitPrice: TcxRadioGroup;
TE_SupplyPrice: TcxTextEdit;
TE_SalePrice: TcxTextEdit;
TE_OtherAreaPrice: TcxTextEdit;
Label_SupplyPrice: TcxLabel;
Label_SalePrice: TcxLabel;
Label_OtherAreaPrice: TcxLabel;
RG_PLanDate: TcxRadioGroup;
TE_CustQTY: TcxTextEdit;
TE_PlanMemo: TcxTextEdit;
Label_CustQTY: TcxLabel;
Label_PlanMemo: TcxLabel;
RG_ProductBasicData: TcxRadioGroup;
Label_ProductNumber: TcxLabel;
TE_ProductName: TcxTextEdit;
Label_ProductCodeLabel: TcxLabel;
Label_ProductNameLabel: TcxLabel;
RG_OtherAttribute: TcxRadioGroup;
DE_NewDate: TcxDateEdit;
LCB_UnitGroup: TcxLookupComboBox;
LCB_Unit: TcxLookupComboBox;
Label_NewDate: TcxLabel;
Label_UnitGroup: TcxLabel;
Label_Unit: TcxLabel;
TE_ProductCode: TcxTextEdit;
procedure BitBtn2Click(Sender: TObject);
procedure LCB_ProductLabelPropertiesChange(Sender: TObject);
procedure BitBtn1Click(Sender: TObject);
procedure LCB_UnitGroupPropertiesChange(Sender: TObject);
procedure CBK_NewLabelClick(Sender: TObject);
procedure LCB_ProductTypePropertiesChange(Sender: TObject);
procedure TE_ProductNumberPropertiesChange(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form_ProductAppend: TForm_ProductAppend;
sGroup,sUnit,TypeID,LabelID,ProductID: String;
implementation
uses Unit_Data;
{$R *.dfm}
procedure TForm_ProductAppend.BitBtn2Click(Sender: TObject);
begin
Close;
end;
procedure TForm_ProductAppend.LCB_ProductLabelPropertiesChange(
Sender: TObject);
begin
IF CBK_LabelForSupply.Checked = True Then
Begin
Form_Data.Table__ProductSupply.Filter := 'cLabel = ''' + LCB_ProductLabel.Text + ''' ';
Form_Data.Table__ProductSupply.Filtered := True;
IF Form_Data.Table__ProductSupply.Eof = False Then
LCB_ProductSupply.Text := Form_Data.Table__ProductSupply.FieldValues['cVenName'];
end Else Begin
Form_Data.Table__ProductSupply.Filtered := False;
End;
IF LCB_ProductType.Text <> '' Then
Begin
TypeID := Form_Data.Table__ProductType.Lookup('cInvCName',LCB_ProductType.Text,'cInvCCode');
TypeID := Copy(TypeID,3,2);
End Else TypeID := '';
IF LCB_ProductLabel.Text <> '' Then
Begin
LabelID := Form_Data.Table__Inventory.Lookup('cLabel',LCB_ProductLabel.Text,'cInvCode');
sGroup := Form_Data.Table__Inventory.Lookup('cLabel',LCB_ProductLabel.Text,'cGroupCode');
sUnit := Form_Data.Table__Inventory.Lookup('cLabel',LCB_ProductLabel.Text,'cComUnitCode');
Form_Data.Table__ComputationUnit.Filter := 'cGroupCode = ''' + sGroup + ''' ';
Form_Data.Table__ComputationUnit.Filtered := True;
LCB_UnitGroup.Text := Form_Data.Table__ComputationGroup.Lookup('cGroupCode',sGroup,'cGroupName');
LCB_Unit.Text := Form_Data.Table__ComputationUnit.Lookup('cComUnitCode',sUnit,'cComUnitName');;
LabelID := Copy(LabelID,3,3);
End Else LabelID := '';
IF TE_ProductNumber.Text <> '' Then
Begin
ProductID := TE_ProductNumber.Text;
While Length(ProductID) < 5 do
Begin
ProductID := ProductID + '0'
end;
End Else ProductID := '';
IF Length(TypeID+LabelID+ProductID) = 10 Then
Begin
TE_ProductCode.Text := TypeID+LabelID+ProductID ;
TE_ProductName.Text := LCB_ProductLabel.Text+'/'+ TE_ProductNumber.Text+LCB_ProductType.Text
End;
end;
procedure TForm_ProductAppend.BitBtn1Click(Sender: TObject);
begin
//寫入存貨資料
//寫入采購資料
//判定是否是文胸類,否則加入存貨價格表
//寫入預計劃表
end;
procedure TForm_ProductAppend.LCB_UnitGroupPropertiesChange(
Sender: TObject);
Var
GroupID : String;
begin
IF LCB_UnitGroup.Text <> '' Then
Begin
GroupID := Form_Data.Table__ComputationGroup.Lookup('cGroupName',LCB_UnitGroup.Text,'cGroupCode');
Form_Data.Table__ComputationUnit.Filter := 'cGroupCode = ''' + GroupID + ''' ';
Form_Data.Table__ComputationUnit.Filtered := True;
LCB_Unit.Text := Form_Data.Table__ComputationUnit.FieldValues['cComUnitName'];
end Else Begin
Form_Data.Table__ComputationUnit.Filtered := False;
End;
end;
procedure TForm_ProductAppend.CBK_NewLabelClick(Sender: TObject);
begin
IF CBK_NewLabel.Checked = False Then
Begin
LCB_ProductLabel.Enabled := False;
CBK_LabelForSupply.Enabled := False;
end Else Begin
LCB_ProductLabel.Enabled := True;
CBK_LabelForSupply.Enabled := True;
End;
end;
procedure TForm_ProductAppend.LCB_ProductTypePropertiesChange(
Sender: TObject);
begin
IF LCB_ProductType.Text <> '' Then
Begin
TypeID := Form_Data.Table__ProductType.Lookup('cInvCName',LCB_ProductType.Text,'cInvCCode');
TypeID := Copy(TypeID,3,2);
End Else TypeID := '';
IF LCB_ProductLabel.Text <> '' Then
Begin
LabelID:= Form_Data.Table__Inventory.Lookup('cLabel',LCB_ProductLabel.Text,'cInvCode');
sGroup := Form_Data.Table__Inventory.Lookup('cLabel',LCB_ProductLabel.Text,'cGroupCode');
sUnit := Form_Data.Table__Inventory.Lookup('cLabel',LCB_ProductLabel.Text,'cComUnitCode');
Form_Data.Table__ComputationUnit.Filter := 'cGroupCode = ''' + sGroup + ''' ';
Form_Data.Table__ComputationUnit.Filtered := True;
LCB_UnitGroup.Text := Form_Data.Table__ComputationGroup.Lookup('cGroupCode',sGroup,'cGroupName');
LCB_Unit.Text := Form_Data.Table__ComputationUnit.Lookup('cComUnitCode',sUnit,'cComUnitName');;
LabelID := Copy(LabelID,3,3);
End Else LabelID := '';
IF TE_ProductNumber.Text <> '' Then
Begin
ProductID := TE_ProductNumber.Text;
While Length(ProductID) < 5 do
Begin
ProductID := ProductID + '0'
end;
End Else ProductID := '';
IF Length(TypeID+LabelID+ProductID) = 10 Then
Begin
TE_ProductCode.Text := TypeID+LabelID+ProductID ;
TE_ProductName.Text := LCB_ProductLabel.Text+'/'+ TE_ProductNumber.Text+LCB_ProductType.Text
End;
DE_NewDate.Date := Now();
end;
procedure TForm_ProductAppend.TE_ProductNumberPropertiesChange(
Sender: TObject);
begin
IF LCB_ProductType.Text <> '' Then
Begin
TypeID := Form_Data.Table__ProductType.Lookup('cInvCName',LCB_ProductType.Text,'cInvCCode');
TypeID := Copy(TypeID,3,2);
End Else TypeID := '';
IF LCB_ProductLabel.Text <> '' Then
Begin
LabelID := Form_Data.Table__Inventory.Lookup('cLabel',LCB_ProductLabel.Text,'cInvCode');
sGroup := Form_Data.Table__Inventory.Lookup('cLabel',LCB_ProductLabel.Text,'cGroupCode');
sUnit := Form_Data.Table__Inventory.Lookup('cLabel',LCB_ProductLabel.Text,'cComUnitCode');
Form_Data.Table__ComputationUnit.Filter := 'cGroupCode = ''' + sGroup + ''' ';
Form_Data.Table__ComputationUnit.Filtered := True;
LCB_UnitGroup.Text := Form_Data.Table__ComputationGroup.Lookup('cGroupCode',sGroup,'cGroupName');
LCB_Unit.Text := Form_Data.Table__ComputationUnit.Lookup('cComUnitCode',sUnit,'cComUnitName');;
LabelID := Copy(LabelID,3,3);
End Else LabelID := '';
IF TE_ProductNumber.Text <> '' Then
Begin
ProductID := TE_ProductNumber.Text;
While Length(ProductID) < 5 do
Begin
ProductID := ProductID + '0'
end;
End Else ProductID := '';
IF Length(TypeID+LabelID+ProductID) = 10 Then
Begin
TE_ProductCode.Text := TypeID+LabelID+ProductID ;
TE_ProductName.Text := LCB_ProductLabel.Text+'/'+ TE_ProductNumber.Text+LCB_ProductType.Text
End;
end;
end.
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -