possettingfrm.pas
来自「群星医药系统源码」· PAS 代码 · 共 267 行
PAS
267 行
unit PosSettingFrm;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, RzButton, ExtCtrls, RzPanel, RzTabs, StdCtrls, Spin, Mask, RzLabel,
RzSpnEdt, RzDBSpin, RzDBCmbo, RzEdit, RzDBEdit, RzCmboBx, RzRadGrp, RzRadChk,
xBaseFrm, IMainFrm,IniFiles,MConnect, RzDBBnEd,SelectDepotFrm, RzBtnEdt,
Printers, DB, DBClient, uRtlUnit;
type
TFmPosSetting = class(TxBaseForm)
RzPageControl1: TRzPageControl;
TabSheet1: TRzTabSheet;
RzPanel1: TRzPanel;
Panel1: TPanel;
BtnOK: TRzBitBtn;
BtnCancel: TRzBitBtn;
TabSheet3: TRzTabSheet;
TabSheet4: TRzTabSheet;
Label8: TLabel;
Label13: TLabel;
Label6: TLabel;
Label7: TLabel;
cbRetailPriceModu: TRzComboBox;
edClassCount: TRzSpinEdit;
CkSalePriceLimit: TRzCheckBox;
GroupBox6: TRzGroupBox;
Label22: TLabel;
Label23: TLabel;
Label24: TLabel;
Label12: TLabel;
Label26: TLabel;
Label27: TLabel;
Label11: TLabel;
Label35: TLabel;
Label36: TLabel;
edBillHeader: TRzEdit;
edBillFooter1: TRzEdit;
edBillFooter2: TRzEdit;
cbHeaderColor: TRzComboBox;
cbFooterColor: TRzComboBox;
cbDetailColor: TRzComboBox;
cbPrintPort: TRzComboBox;
edPrintDelay: TRzSpinEdit;
GroupBox7: TRzGroupBox;
Label38: TLabel;
cbPrinter: TRzComboBox;
rbPagePrintMode: TRzRadioButton;
rbLinePrintMode: TRzRadioButton;
GroupBox2: TRzGroupBox;
Label9: TLabel;
Label48: TLabel;
Label49: TLabel;
Label50: TLabel;
Label51: TLabel;
Label52: TLabel;
cbBuyerDispPort: TRzComboBox;
cbBuyerDispType: TRzComboBox;
edLineDispChars: TRzSpinEdit;
edDispOutDelay: TRzSpinEdit;
edBaudRate: TRzSpinEdit;
Label10: TLabel;
CkAutoAddEmptyLine: TRzCheckBox;
CkAutoTakePayMoney: TRzCheckBox;
RaPrintBill: TRzRadioGroup;
Label14: TLabel;
cbPromotePriceModu: TRzComboBox;
Label25: TLabel;
edMaxChange: TRzSpinEdit;
edDepotName: TRzButtonEdit;
edDepotID: TRzNumericEdit;
edRetailModeNo: TRzNumericEdit;
edSaleModeNo: TRzNumericEdit;
RzButton1: TRzButton;
CdsTemp: TClientDataSet;
CdsTemp1: TClientDataSet;
RzGroupBox1: TRzGroupBox;
cmbCashboxPort: TRzComboBox;
rgCashBoxPort: TRzRadioGroup;
procedure FormCreate(Sender: TObject);
procedure cbRetailPriceModuChange(Sender: TObject);
procedure cbPromotePriceModuChange(Sender: TObject);
procedure edDepotNameButtonClick(Sender: TObject);
procedure BtnOKClick(Sender: TObject);
procedure BtnCancelClick(Sender: TObject);
procedure RzButton1Click(Sender: TObject);
private
{ Private declarations }
lPayModeNo,lPayModeName : TStrings;
iClientID : Integer;
SvrCommon : TDispatchConnection;
iFmMain : IMainForm;
public
{ Public declarations }
end;
Const
sPayMode ='Select ModeNO,ModeName From PriceModes Where DataUsable=1 ';
var
FmPosSetting: TFmPosSetting;
implementation
Uses RepSelectFrm, RetailFrm;
{$R *.dfm}
procedure TFmPosSetting.FormCreate(Sender: TObject);
Var
iRtlPriceMode, iSalePriceMode: Integer;
vRet: Variant;
str: String;
K,i: Integer;
begin
IFmMain:=Application.MainForm As IMainForm;
iClientID := IFmMain.IFmMainEx.ClientID;
SvrCommon := IFmMain.GetConnection(Handle,'','CommonSvr.CommonRDM');
lPayModeNo := TStringList.Create;
lPayModeName := TStringList.Create;
vRet := SvrCommon.AppServer.GetNeedValue(iClientID,2,sPayMode);
If (Not VarIsNull(vRet)) And (VarIsArray(vRet)) Then
Begin
k := VarArrayHighBound(vRet,2);
for i:=VarArrayLowBound(vRet,2) to k do
Begin
lPayModeNo.Add(vRet[0,i]);
lPayModeName.Add(vRet[1,i]);
End;
End;
cbRetailPriceModu.Items.Assign(lPayModeName);
cbPromotePriceModu.Items.Assign(lPayModeName);
with BaseSetting do
begin
edClassCount.IntValue := ClassCount;
iRtlPriceMode := RtlPriceMode;
iSalePriceMode := SalePriceMode;
If iRtlPriceMode<>0 Then Begin
edRetailModeNo.Text := IntToStr(iRtlPriceMode);
cbRetailPriceModu.ItemIndex := lPayModeNo.IndexOf(IntToStr(iRtlPriceMode)) ;
End;
If iSalePriceMode<>0 Then Begin
edSaleModeNo.Text := IntToStr(iSalePriceMode);
cbPromotePriceModu.ItemIndex := lPayModeNo.IndexOf(IntToStr(iSalePriceMode)) ;
End;
edDepotID.IntValue := DepotID;
edDepotName.Text := DepotName;
edMaxChange.IntValue := MaxChange;
CkSalePriceLimit.Checked := PriceLimited;
end;
cbPrinter.Items.Assign(Printer.Printers);
with FixingSetting do
begin
rbLinePrintMode.Checked := FixingSetting.LinePrintMode;
cbPrintPort.Text := FixingSetting.PrintPort;
edPrintDelay.IntValue := FixingSetting.PrintDelay;
edBillHeader.Text := FixingSetting.BillHeader;
cbHeaderColor.ItemIndex := FixingSetting.HeaderColor;
edBillFooter1.Text := FixingSetting.BillFooter1;
cbDetailColor.ItemIndex := FixingSetting.DetailColor;
edBillFooter2.Text := FixingSetting.BillFooter2;
cbFooterColor.ItemIndex := FixingSetting.FooterColor;
rbPagePrintMode.Checked := not FixingSetting.LinePrintMode;
cbPrinter.Text := FixingSetting.Printer;
RaPrintBill.ItemIndex := FixingSetting.BillPrintMode;
cbBuyerDispPort.Text := FixingSetting.BuyerDispPort;
cbBuyerDispType.ItemIndex := FixingSetting.BuyerDispType;
edBaudRate.IntValue := FixingSetting.BaudRate;
edLineDispChars.IntValue:= FixingSetting.LineDispChars;
edDispOutDelay.IntValue := FixingSetting.DispOutDelay;
str := FixingSetting.CashboxPort;
if str='0' then
rgCashBoxPort.ItemIndex := 0
else if str='1' then
rgCashBoxPort.ItemIndex := 1
else begin
rgCashBoxPort.ItemIndex := 2;
cmbCashboxPort.Text := str;
end;
//
CkAutoAddEmptyLine.Checked := UserSetting.AutoAddEmptyLine;
CkAutoTakePayMoney.Checked := UserSetting.AutoTakePayMoney;
End;
End;
procedure TFmPosSetting.cbRetailPriceModuChange(Sender: TObject);
begin
edRetailModeNo.Text := lPayModeNo[cbRetailPriceModu.ItemIndex];
end;
procedure TFmPosSetting.cbPromotePriceModuChange(Sender: TObject);
begin
edSaleModeNo.Text := lPayModeNo[cbPromotePriceModu.ItemIndex];
end;
procedure TFmPosSetting.edDepotNameButtonClick(Sender: TObject);
var iDepotID: Integer;
DepotNo,DepotName: string;
begin
iDepotID := StrToInt(edDepotID.Text);
If SelectDepot(iDepotID,DepotNo,DepotName) Then Begin
edDepotID.Text := IntToStr(iDepotID);
edDepotName.Text := '['+DepotNo+']'+DepotName;
End;
end;
procedure TFmPosSetting.BtnOKClick(Sender: TObject);
begin
BaseSetting.ClassCount := edClassCount.IntValue;
BaseSetting.DepotID := edDepotID.IntValue;
BaseSetting.DepotName := edDepotName.Text;
BaseSetting.MaxChange := edMaxChange.IntValue;
BaseSetting.PriceLimited := CkSalePriceLimit.Checked;
BaseSetting.RtlPriceMode := edRetailModeNo.IntValue;
BaseSetting.SalePriceMode := edSaleModeNo.IntValue;
//
FixingSetting.LinePrintMode := rbLinePrintMode.Checked;
FixingSetting.PrintPort := cbPrintPort.Text;
FixingSetting.PrintDelay := edPrintDelay.IntValue;
FixingSetting.BillHeader := edBillHeader.Text;
FixingSetting.HeaderColor := cbHeaderColor.ItemIndex;
FixingSetting.BillFooter1 := edBillFooter1.Text;
FixingSetting.DetailColor := cbDetailColor.ItemIndex;
FixingSetting.BillFooter2 := edBillFooter2.Text;
FixingSetting.FooterColor := cbFooterColor.ItemIndex;
FixingSetting.Printer := cbPrinter.Text;
FixingSetting.BillPrintMode := RaPrintBill.ItemIndex;
FixingSetting.BuyerDispPort := cbBuyerDispPort.Text;
FixingSetting.BuyerDispType := cbBuyerDispType.ItemIndex ;
FixingSetting.BaudRate := edBaudRate.IntValue ;
FixingSetting.LineDispChars := edLineDispChars.IntValue ;
FixingSetting.DispOutDelay := edDispOutDelay.IntValue;
if rgCashBoxPort.ItemIndex=2 then
FixingSetting.CashboxPort := cmbCashboxPort.Text
else
FixingSetting.CashboxPort := IntToStr(rgCashBoxPort.ItemIndex);
//
UserSetting.AutoAddEmptyLine := CkAutoAddEmptyLine.Checked;
UserSetting.AutoTakePayMoney := CkAutoTakePayMoney.Checked;
SaveSetting;
end;
procedure TFmPosSetting.BtnCancelClick(Sender: TObject);
begin
If Application.MessageBox('确定已保存好当前数据?','提示',4+32)=6 Then
Close;
end;
procedure TFmPosSetting.RzButton1Click(Sender: TObject);
Const
sMastFields = ' FDate,BranchID,MachNo,BillNo,TeamNo,PayeeNo,BornSum,Amount,PayMoney ';
begin
CdsTemp.Close;
CdsTemp.Data := SvrCommon.AppServer.GetRetail(iClientID,'',sMastFields);
CdsTemp1.Close;
CdsTemp1.Data := SvrCommon.AppServer.GetRetailDtl(iClientID,'');
SelRepPrint('零售报表', [CdsTemp, cdsTemp1], '销售单;销售明细');
end;
initialization
RegisterClass(TFmPosSetting);
finalization
UnRegisterClass(TFmPosSetting);
end.
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?