📄 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, KsHooks, KsForms, KsSkinForms, KsControls,
KsButtons, KsSkinButtons, KsLabels, KsSkinLabels, KsPanels, KsSkinPanels,
sncCurrency, sncDBCurrency, Grids, KsCheckBoxs, KsSkinCheckBoxs,
KsGroupBoxs, KsSkinGroupBoxs;
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 := '客 户:';
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -