?? existbilledit.pas
字號:
unit ExistBillEdit;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
BaseBillEdit, StdCtrls, ExtCtrls, dxCntner, dxTL, dxDBCtrl, dxDBGrid,
Buttons, Db, DBTables, ImgList, dxEdLib,
dxDBELib, dxEditor, dxExEdtr, DBCtrls, dxGrClms, dxDBTLCl, DBData, ADODB,
Menus, DBGrids, dxBar, KsSkinForms, KsSkinButtons, KsSkinLabels, KsSkinPanels,
sncCurrency, sncDBCurrency, Grids, KsSkinCheckBoxs, KsSkinGroupBoxs, se_controls;
type
TfrmExistBillEdit = class(TfrmBaseBillEdit)
edtMemo: TdxDBEdit;
Label3: TSeSkinLabel;
lblMemo: TSeSkinLabel;
lblBillDate: TSeSkinLabel;
edtBillDate: TdxDBDateEdit;
lblUserCode: TSeSkinLabel;
edtUserCode: TdxDBEdit;
lblUnit: TSeSkinLabel;
lblEmploye: TSeSkinLabel;
lblAddress: TSeSkinLabel;
edtAddress: TdxDBEdit;
lblDepot: TSeSkinLabel;
lblInvoice: TSeSkinLabel;
edtInvoice: TdxDBPickEdit;
edtUnit: TdxButtonEdit;
edtEmploye: TdxButtonEdit;
lblBillNum: TSeSkinLabel;
edtBillNum: TdxDBEdit;
edtDepot: TdxButtonEdit;
lblDepot2: TSeSkinLabel;
edtDepot2: TdxButtonEdit;
lblWare: TSeSkinLabel;
edtWare: TdxButtonEdit;
lblPrice: TSeSkinLabel;
edtPrice: TdxDBEdit;
lblNumber: TSeSkinLabel;
edtNumber: TdxDBEdit;
lblTotal: TSeSkinLabel;
edtTotal: TdxDBCurrencyEdit;
boxCombin: TSeSkinGroupBox;
rbZh: TSeSkinRadioButton;
rbCx: TSeSkinRadioButton;
procedure edtUnitButtonClick(Sender: TObject; AbsoluteIndex: Integer);
procedure edtEmployeButtonClick(Sender: TObject;
AbsoluteIndex: Integer);
procedure bbOkClick(Sender: TObject);
procedure edtDepotButtonClick(Sender: TObject; AbsoluteIndex: Integer);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure mnPrintInitClick(Sender: TObject);
procedure bbSetupClick(Sender: TObject);
procedure bbPrevClick(Sender: TObject);
procedure bbNextClick(Sender: TObject);
procedure edtBillDateKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
procedure gridMainChangeColumn(Sender: TObject; Node: TdxTreeListNode; Column: Integer);
procedure edtDepot2ButtonClick(Sender: TObject; AbsoluteIndex: Integer);
procedure edtWareButtonClick(Sender: TObject; AbsoluteIndex: Integer);
procedure edtNumberExit(Sender: TObject);
procedure edtPriceExit(Sender: TObject);
procedure ADOSetListBeforeScroll(DataSet: TDataSet);
procedure edtUnitExit(Sender: TObject);
procedure edtEmployeExit(Sender: TObject);
procedure edtWareExit(Sender: TObject);
procedure edtDepotExit(Sender: TObject);
procedure edtDepot2Exit(Sender: TObject);
private
{ Private declarations }
sReturn: string;
sUniqueTable: string;
bPriceCan0: Boolean;
function ReturnSQL(lType, lMode, lBillID: Integer): string;
procedure ToolShow;
procedure BillRowSummary;
procedure EditShow;
procedure FieldToEdit;
procedure LoadGrid;
procedure LoadData;
procedure SaveData(lType: Integer);
function CheckMsg: Boolean;
procedure MainShow;
procedure CalcTotal;
public
{ Public declarations }
end;
function ExistBillEditShow(l1Mode, l1ID: Integer): string;
implementation
uses SysPublic, BillEdit;
{$R *.DFM}
function ExistBillEditShow(l1Mode, l1ID: Integer): string;
var
frmExistBillEdit: TfrmExistBillEdit;
begin
frmExistBillEdit := TfrmExistBillEdit.Create(Application);
with frmExistBillEdit do
begin
lMode := l1Mode;
lID := l1ID;
MainShow;
Result := sReturn;
Free;
end;
end;
procedure TfrmExistBillEdit.MainShow;
begin
if lMode = 0 then
Exit;
InitialBillSetup(lMode);
LoadGrid;
EditShow;
LoadData;
ToolShow;
ShowModal;
end;
procedure TfrmExistBillEdit.LoadGrid;
var
btnColumn: TdxDBGridButtonColumn;
sFieldName, sCaption, sWidth, sNoDisPlay, sReadOnly: string;
begin
sReturn := '';
sUniqueTable := '';
Caption := 'XXXX 單據';
lSelectMode := 0;
lOneRet := 0;
sFieldName := 'Field';
sCaption := 'TopName';
sWidth := 'Width';
sNoDisPlay := 'Display';
sReadOnly := 'Read';
bPriceCan0 := StrToBool2(GetIniValue(frmData.ADOConnet, 'BillPriceCan0'));
GetDataField(sFieldName, sCaption, sWidth, sNoDisPlay, sReadOnly);
StrToGridField(gridMain, sFieldName, sCaption, sWidth);
SetBillDisPlay(sNoDisPlay);
SetBillReadOnly(sReadOnly);
case lMode of
EXIST_DRAW, EXIST_RETURN, EXIST_LOSING, EXIST_INCREASE, EXIST_ENTER_DEPOT,
EXIST_CHECK_LIST, EXIST_CHANGE_PRICE, EXIST_EXCHANGE, EXIST_ASSEMBLY,
EXIST_OTHER, EXIST_PRICE_EXCHANGE, EXIST_PRESENT, EXIST_GAIN:
begin
//設置[編號列]為Button方式,并對應單擊事件.
ChangColumnType(gridMain, gridMain.ColumnByFieldName('WareCode'),
TdxDBGridButtonColumn);
btnColumn := TdxDBGridButtonColumn(gridMain.ColumnByFieldName('WareCode'));
btnColumn.OnButtonClick := GridButtonClick;
btnColumn.ClickKey := VK_RETURN;
//設置[商品名稱列]為Button方式,并對應單擊事件.
ChangColumnType(gridMain, gridMain.ColumnByFieldName('WareName'), TdxDBGridButtonColumn);
btnColumn := TdxDBGridButtonColumn(gridMain.ColumnByFieldName('WareName'));
btnColumn.OnButtonClick := GridButtonClick;
btnColumn.ClickKey := VK_RETURN;
case lMode of
EXIST_CHANGE_PRICE, EXIST_PRICE_EXCHANGE, EXIST_ASSEMBLY:
begin
//設置[商品單價列]為Button方式,并對應單擊事件.
ChangColumnType(gridMain, gridMain.ColumnByFieldName('Price'), TdxDBGridButtonColumn);
btnColumn := TdxDBGridButtonColumn(gridMain.ColumnByFieldName('Price'));
btnColumn.OnButtonClick := GridSelectPrice;
end;
end;
end;
end;
case lMode of
EXIST_DRAW:
begin
Caption := '領料單';
SetGridSummary(gridMain, 'WareName,Number');
end;
EXIST_RETURN:
begin
Caption := '退料單';
SetGridSummary(gridMain, 'WareName,Number');
end;
EXIST_LOSING:
begin
Caption := '報損單';
SetGridSummary(gridMain, 'WareName,Number');
end;
EXIST_INCREASE:
begin
Caption := '報溢單';
SetGridSummary(gridMain, 'WareName,Number');
end;
EXIST_PRESENT:
begin
Caption := '贈送單';
SetGridSummary(gridMain, 'WareName,Number');
end;
EXIST_GAIN:
begin
Caption := '獲贈單';
SetGridSummary(gridMain, 'WareName,Number');
end;
EXIST_ENTER_DEPOT:
begin
Caption := '產品進倉';
SetGridSummary(gridMain, 'WareName,Number');
end;
EXIST_CHECK_LIST:
begin
Caption := '庫存盤點';
SetGridSummary(gridMain, 'WareName,Number');
end;
EXIST_CHANGE_PRICE:
begin
Caption := '存貨調價';
SetGridSummary(gridMain, 'WareName,Number,Price,Total');
end;
EXIST_EXCHANGE:
begin
Caption := '同價調撥';
SetGridSummary(gridMain, 'WareName,Number');
edtInvoice.Items.Text := '入庫類' + #13 + '出庫類';
end;
EXIST_PRICE_EXCHANGE:
begin
Caption := '變價調撥';
SetGridSummary(gridMain, 'WareName,Number,Price,Total');
edtInvoice.Items.Text := '入庫類' + #13 + '出庫類';
end;
EXIST_ASSEMBLY:
begin
Caption := '組裝與拆卸';
SetGridSummary(gridMain, 'WareName,Number,Price,Total');
end;
EXIST_OTHER:
begin
Caption := '庫存變動';
SetGridSummary(gridMain, 'WareName,Number');
end;
MONEY_EXPENSES:
begin
Caption := '其它費用單';
SetGridSummary(gridMain, 'WareName,Total');
end;
MONEY_INCOME:
begin
Caption := '其它收入單';
SetGridSummary(gridMain, 'WareName,Total');
end;
MONEY_DEPOSIT:
begin
Caption := '銀行存取款';
SetGridSummary(gridMain, 'WareName,Total');
end;
else
ShowMsg('內部參數出錯,請與開發商聯系!');
end;
lblCaption.Caption := Caption;
SetDrawGridSummary(gridMain);
end;
procedure TfrmExistBillEdit.ToolShow;
begin
end;
procedure TfrmExistBillEdit.EditShow;
var
lOldTop: Integer;
begin
case lMode of
EXIST_DRAW:
begin
lblDepot.Visible := True;
edtDepot.Visible := True;
lblDepot.Caption := '領 料 倉:';
lblEmploye.Visible := True;
edtEmploye.Visible := True;
lblEmploye.Caption := '領 料 人:';
lblMemo.Visible := True;
edtMemo.Visible := True;
lblMemo.Caption := '備 注:';
lblMemo.Left := lblAddress.Left;
edtMemo.Left := edtAddress.Left;
edtMemo.Width := edtMemo.Width * 2;
lblMemo.Top := lblDepot.Top;
edtMemo.Top := edtDepot.Top;
lblDepot.Top := lblEmploye.Top;
edtDepot.Top := edtEmploye.Top;
pnlBillTop.Height := 60;
Panel1.Height := 100; //改變Panel大小
lOldTop := gridMain.Top;
gridMain.Top := Panel1.Top + Panel1.Height + 5;
gridMain.Height := gridMain.Height + (lOldTop - gridMain.Top); //改變表格大小
edtDepot.TabOrder := 0;
edtEmploye.TabOrder := 1;
edtMemo.TabOrder := 2; //設置按鈕次序
end;
EXIST_RETURN:
begin
lblDepot.Visible := True;
edtDepot.Visible := True;
lblDepot.Caption := '退 料 倉:';
lblEmploye.Visible := True;
edtEmploye.Visible := True;
lblEmploye.Caption := '退 料 人:';
lblMemo.Visible := True;
edtMemo.Visible := True;
lblMemo.Caption := '備 注:';
lblMemo.Left := lblAddress.Left;
edtMemo.Left := edtAddress.Left;
edtMemo.Width := edtMemo.Width * 2;
lblMemo.Top := lblDepot.Top;
edtMemo.Top := edtDepot.Top;
lblDepot.Top := lblEmploye.Top;
edtDepot.Top := edtEmploye.Top;
pnlBillTop.Height := 60;
Panel1.Height := 100; //改變Panel大小
lOldTop := gridMain.Top;
gridMain.Top := Panel1.Top + Panel1.Height + 5;
gridMain.Height := gridMain.Height + (lOldTop - gridMain.Top); //改變表格大小
edtDepot.TabOrder := 0;
edtEmploye.TabOrder := 1;
edtMemo.TabOrder := 2; //設置按鈕次序
end;
EXIST_LOSING:
begin
lblDepot.Visible := True;
edtDepot.Visible := True;
lblDepot.Caption := '倉 庫:';
lblEmploye.Visible := True;
edtEmploye.Visible := True;
lblEmploye.Caption := '報 損 人:';
lblMemo.Visible := True;
edtMemo.Visible := True;
lblMemo.Caption := '備 注:';
lblMemo.Left := lblAddress.Left;
edtMemo.Left := edtAddress.Left;
edtMemo.Width := edtMemo.Width * 2;
lblMemo.Top := lblDepot.Top;
edtMemo.Top := edtDepot.Top;
lblDepot.Top := lblEmploye.Top;
edtDepot.Top := edtEmploye.Top;
pnlBillTop.Height := 60;
Panel1.Height := 100; //改變Panel大小
lOldTop := gridMain.Top;
gridMain.Top := Panel1.Top + Panel1.Height + 5;
gridMain.Height := gridMain.Height + (lOldTop - gridMain.Top); //改變表格大小
edtDepot.TabOrder := 0;
edtEmploye.TabOrder := 1;
edtMemo.TabOrder := 2; //設置按鈕次序
end;
EXIST_INCREASE:
begin
lblDepot.Visible := True;
edtDepot.Visible := True;
lblDepot.Caption := '倉 庫:';
lblEmploye.Visible := True;
edtEmploye.Visible := True;
lblEmploye.Caption := '報 益 人:';
lblMemo.Visible := True;
edtMemo.Visible := True;
lblMemo.Caption := '備 注:';
lblMemo.Left := lblAddress.Left;
edtMemo.Left := edtAddress.Left;
edtMemo.Width := edtMemo.Width * 2;
lblMemo.Top := lblDepot.Top;
edtMemo.Top := edtDepot.Top;
lblDepot.Top := lblEmploye.Top;
edtDepot.Top := edtEmploye.Top;
pnlBillTop.Height := 60;
Panel1.Height := 100; //改變Panel大小
lOldTop := gridMain.Top;
gridMain.Top := Panel1.Top + Panel1.Height + 5;
gridMain.Height := gridMain.Height + (lOldTop - gridMain.Top); //改變表格大小
edtDepot.TabOrder := 0;
edtEmploye.TabOrder := 1;
edtMemo.TabOrder := 2; //設置按鈕次序
end;
EXIST_PRESENT:
begin
lblUnit.Visible := True;
edtUnit.Visible := True;
lblUnit.Caption := '客 戶:';
lblEmploye.Visible := True;
edtEmploye.Visible := True;
lblEmploye.Caption := '經 手 人:';
lblMemo.Visible := True;
edtMemo.Visible := True;
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -