Commit 7f54f66b authored by kravtsov's avatar kravtsov

[-] Исправлена ошибка при закрытии чека

parent 515d0076
......@@ -4,6 +4,13 @@
Company : SHTRIH-M, Russia, Moscow, Masterkova 4
(495) 787-60-90, www.shtrih-m.ru
*******************************************************************
OposShtrih_1.13_475.exe
15 февраля 2018 21:35
[-] Исправлена ошибка при закрытии чека
*******************************************************************
OposShtrih_1.13_474.exe
......
[Closed Files]
File_0=SourceModule,'C:\projects\OPOSShtrih\Source\SmFiscalPrinter\Units\SalesReceipt.pas',0,1,1,1,1,0,0
File_0=SourceModule,'C:\projects\OPOSShtrih\Source\SmFiscalPrinter\Units\PrinterTypes.pas',0,1,166,17,190,0,0
File_1=SourceModule,'C:\projects\OPOSShtrih\Source\SmFiscalPrinter\Units\CustomReceipt.pas',0,1,430,2,432,0,0
File_2=SourceModule,'C:\projects\OPOSShtrih\Source\SmFiscalPrinter\Units\SharedPrinter.pas',0,1,1,1,1,0,0
File_3=SourceModule,'C:\projects\OPOSShtrih\Source\SmFiscalPrinter\Units\FiscalPrinterDevice.pas',0,1,1,1,1,0,0
......@@ -11,10 +11,20 @@ File_8=SourceModule,'C:\projects\OPOSShtrih\Source\SmFiscalPrinter\Units\FSSales
File_9=SourceModule,'C:\projects\OPOSShtrih\Source\SmFiscalPrinter\Units\PrinterParameters.pas',0,1,1,1,1,0,0
[Modules]
Count=0
EditWindowCount=0
Module0=C:\projects\OPOSShtrih\Source\SmFiscalPrinter\Units\SalesReceipt.pas
Count=1
EditWindowCount=1
TypeLibWindowCount=3
[C:\projects\OPOSShtrih\Source\SmFiscalPrinter\Units\SalesReceipt.pas]
ModuleType=SourceModule
FormState=0
FormOnTop=0
[C:\projects\OPOSShtrih\Test\SmScaleTest\SmScaleTestLib.dpr]
FormState=0
FormOnTop=0
[C:\projects\OPOSShtrih\Source\OposShtrih.bpg]
FormState=0
FormOnTop=0
......@@ -87,9 +97,39 @@ FormOnTop=0
FormState=0
FormOnTop=0
[C:\projects\OPOSShtrih\Test\SmScaleTest\SmScaleTestLib.dpr]
FormState=0
FormOnTop=0
[EditWindow0]
ViewCount=1
CurrentView=0
View0=0
CodeExplorer=CodeExplorer@EditWindow0
MessageView=MessageView@EditWindow0
Create=1
Visible=1
State=2
Left=323
Top=138
Width=1302
Height=682
MaxLeft=-8
MaxTop=106
MaxWidth=1936
MaxHeight=952
ClientWidth=1920
ClientHeight=914
LeftPanelSize=0
LeftPanelClients=CodeExplorer@EditWindow0
LeftPanelData=00000400010000000C000000436F64654578706C6F7265720000000000000000000000000000000000FFFFFFFF
RightPanelSize=0
BottomPanelSize=0
BottomPanelClients=MessageView@EditWindow0
BottomPanelData=00000400010000000B0000004D657373616765566965770000000000000000000000000000000000FFFFFFFF
[View0]
Module=C:\projects\OPOSShtrih\Source\SmFiscalPrinter\Units\SalesReceipt.pas
CursorX=34
CursorY=672
TopLine=662
LeftCol=1
[TypeLibEditWindow0]
Create=1
......@@ -414,6 +454,38 @@ Column2Width=545
EntryPointPane=225
CompUnitPane=104
[CodeExplorer@EditWindow0]
Create=1
Visible=0
State=0
Left=-127
Top=-6
Width=140
Height=305
MaxLeft=-1
MaxTop=-1
ClientWidth=140
ClientHeight=305
TBDockHeight=305
LRDockWidth=140
Dockable=1
[MessageView@EditWindow0]
Create=1
Visible=0
State=0
Left=-133
Top=-705
Width=443
Height=85
MaxLeft=-1
MaxTop=-1
ClientWidth=443
ClientHeight=85
TBDockHeight=85
LRDockWidth=443
Dockable=1
[DockHosts]
DockHostCount=0
......
......@@ -107,6 +107,7 @@ begin
AddTest(TReceiptTest16);
AddTest(TReceiptTest17);
AddTest(TReceiptTest18);
AddTest(TReceiptTest19);
cbTest.ItemIndex := 0;
end;
......
......@@ -774,6 +774,14 @@ type
function GetDisplayText: string; override;
end;
{ TReceiptTest19 }
TReceiptTest19 = class(TDriverTest)
public
procedure Execute; override;
function GetDisplayText: string; override;
end;
implementation
const
......@@ -4527,4 +4535,77 @@ begin
Check(FiscalPrinter.EndFiscalReceipt(True));
end;
{ TReceiptTest19 }
function TReceiptTest19.GetDisplayText: string;
begin
Result := 'TReceiptTest19';
end;
procedure TReceiptTest19.Execute;
begin
Check(FiscalPrinter.ResetPrinter());
FiscalPrinter.FiscalReceiptType := FPTR_RT_SALES;
FiscalPrinter.BeginFiscalReceipt(True);
FiscalPrinter.DirectIO2(9, 5, ' ');
FiscalPrinter.DirectIO2(9, 5, ':281 :8');
FiscalPrinter.DirectIO2(30, 72, '4');
FiscalPrinter.DirectIO2(30, 73, '1');
FiscalPrinter.PrintRecItem('1861 SPRITE 2.0', 4.3, 1000, 1, 4.3, '');
FiscalPrinter.DirectIO2(9, 5, ' : 0,70');
FiscalPrinter.DirectIO2(30, 72, '4');
FiscalPrinter.DirectIO2(30, 73, '1');
FiscalPrinter.PrintRecItem('1896 FROSCH 750', 196.94, 1000, 1, 196.94, '');
FiscalPrinter.DirectIO2(9, 5, ' : 32,06');
FiscalPrinter.DirectIO2(30, 72, '4');
FiscalPrinter.DirectIO2(30, 73, '1');
FiscalPrinter.PrintRecItem('3757 1', 430, 1000, 1, 430, '');
FiscalPrinter.DirectIO2(9, 5, ' : 70,00');
FiscalPrinter.DirectIO2(30, 72, '4');
FiscalPrinter.DirectIO2(30, 73, '1');
FiscalPrinter.PrintRecItem('9654 1 ', 435.15, 1000, 3, 435.15, '');
FiscalPrinter.DirectIO2(9, 5, ' : 70,85');
FiscalPrinter.PrintRecSubtotal(1066.39);
FiscalPrinter.DirectIO2(9, 5, ' : 173,61');
FiscalPrinter.DirectIO2(9, 5, ' ');
FiscalPrinter.DirectIO2(9, 2, ': 1066,39');
FiscalPrinter.DirectIO2(9, 5, ' ');
FiscalPrinter.PrintRecTotal(0, 1066.39, '1');
FiscalPrinter.DirectIO2(41, 2, ' ');
FiscalPrinter.DirectIO2(41, 1, ' ');
FiscalPrinter.DirectIO2(9, 5, '---------------------------------------------------');
FiscalPrinter.DirectIO2(9, 5, ' : 7789****7517');
FiscalPrinter.DirectIO2(9, 5, ', : 106');
FiscalPrinter.DirectIO2(9, 5, ', : 1236');
FiscalPrinter.DirectIO2(9, 5, ' : 123,60 ');
FiscalPrinter.DirectIO2(9, 5, ', : 195517');
FiscalPrinter.DirectIO2(9, 5, '---------------------------------------------------');
FiscalPrinter.DirectIO2(9, 5, ' "" ');
FiscalPrinter.DirectIO2(9, 5, ',.,.19, ');
FiscalPrinter.DirectIO2(9, 5, '. 123-4567 ');
FiscalPrinter.DirectIO2(9, 5, '13.02.18 17:35 ');
FiscalPrinter.DirectIO2(9, 5, ' ');
FiscalPrinter.DirectIO2(9, 5, ' ');
FiscalPrinter.DirectIO2(9, 5, ' : 0002 ');
FiscalPrinter.DirectIO2(9, 5, ': 00749970 ');
FiscalPrinter.DirectIO2(9, 5, ' : 744444445555 ');
FiscalPrinter.DirectIO2(9, 5, ' Visa A0000000031010 ');
FiscalPrinter.DirectIO2(9, 5, ':(E); ************8943 ');
FiscalPrinter.DirectIO2(9, 5, ': ');
FiscalPrinter.DirectIO2(9, 5, ' ();: ');
FiscalPrinter.DirectIO2(9, 5, ' 1066.39 ');
FiscalPrinter.DirectIO2(9, 5, ' - 0 . ');
FiscalPrinter.DirectIO2(9, 5, ' ');
FiscalPrinter.DirectIO2(9, 5, ' : 45Q861 ');
FiscalPrinter.DirectIO2(9, 5, ' : 151853253561 ');
FiscalPrinter.DirectIO2(9, 5, ' - ');
FiscalPrinter.DirectIO2(9, 5, ' _________________________________ ');
FiscalPrinter.DirectIO2(9, 5, ' (); ');
FiscalPrinter.DirectIO2(9, 5, 'BF65AE814907799992E9E345DD9BC2084034FFD3 ');
FiscalPrinter.DirectIO2(9, 5, '======================================== ');
FiscalPrinter.DirectIO2(9, 5, ' ');
FiscalPrinter.DirectIO2(9, 5, '---------------------------------------------------');
FiscalPrinter.EndFiscalReceipt(True);
end;
end.
......@@ -1156,10 +1156,7 @@ begin
Device.Lock;
try
State.CheckState(FPTR_PS_FISCAL_RECEIPT_ENDING);
if FIsVoided then
begin
Device.CancelReceipt;
end else
if not FIsVoided then
begin
OpenReceipt(FRecType);
......@@ -1194,33 +1191,39 @@ begin
Device.Lock;
try
Printer.WaitForPrinting;
if Device.CapFSCloseReceipt2 then
if FIsVoided then
begin
CloseParams2.Payments := FPayments;
CloseParams2.Discount := FAdjustmentAmount;
CloseParams2.TaxAmount[1] := StrToInt64Def(Parameters.Parameter1, 0);
CloseParams2.TaxAmount[2] := StrToInt64Def(Parameters.Parameter2, 0);
CloseParams2.TaxAmount[3] := StrToInt64Def(Parameters.Parameter3, 0);
CloseParams2.TaxAmount[4] := StrToInt64Def(Parameters.Parameter4, 0);
CloseParams2.TaxAmount[5] := StrToInt64Def(Parameters.Parameter5, 0);
CloseParams2.TaxAmount[6] := StrToInt64Def(Parameters.Parameter6, 0);
CloseParams2.TaxSystem := StrToInt64Def(Parameters.Parameter7, 0);
CloseParams2.Text := Parameters.CloseRecText;
Device.Check(Device.ReceiptClose2(CloseParams2, CloseResult2));
Device.CancelReceipt;
end else
begin
CloseParams.CashAmount := FPayments[0];
CloseParams.Amount2 := FPayments[1];
CloseParams.Amount3 := FPayments[2];
CloseParams.Amount4 := FPayments[3];
CloseParams.PercentDiscount := FAdjustmentAmount;
CloseParams.Tax1 := 0;
CloseParams.Tax2 := 0;
CloseParams.Tax3 := 0;
CloseParams.Tax4 := 0;
CloseParams.Text := Parameters.CloseRecText;
Printer.ReceiptClose(CloseParams);
if Device.CapFSCloseReceipt2 then
begin
CloseParams2.Payments := FPayments;
CloseParams2.Discount := FAdjustmentAmount;
CloseParams2.TaxAmount[1] := StrToInt64Def(Parameters.Parameter1, 0);
CloseParams2.TaxAmount[2] := StrToInt64Def(Parameters.Parameter2, 0);
CloseParams2.TaxAmount[3] := StrToInt64Def(Parameters.Parameter3, 0);
CloseParams2.TaxAmount[4] := StrToInt64Def(Parameters.Parameter4, 0);
CloseParams2.TaxAmount[5] := StrToInt64Def(Parameters.Parameter5, 0);
CloseParams2.TaxAmount[6] := StrToInt64Def(Parameters.Parameter6, 0);
CloseParams2.TaxSystem := StrToInt64Def(Parameters.Parameter7, 0);
CloseParams2.Text := Parameters.CloseRecText;
Device.Check(Device.ReceiptClose2(CloseParams2, CloseResult2));
end else
begin
CloseParams.CashAmount := FPayments[0];
CloseParams.Amount2 := FPayments[1];
CloseParams.Amount3 := FPayments[2];
CloseParams.Amount4 := FPayments[3];
CloseParams.PercentDiscount := FAdjustmentAmount;
CloseParams.Tax1 := 0;
CloseParams.Tax2 := 0;
CloseParams.Tax3 := 0;
CloseParams.Tax4 := 0;
CloseParams.Text := Parameters.CloseRecText;
Printer.ReceiptClose(CloseParams);
end;
end;
try
......
......@@ -695,6 +695,9 @@ end;
function CenterGraphicsLine(const Data: string; MaxLen, Scale: Integer): string;
begin
if Scale = 0 then
raise Exception.Create('Scale = 0');
Result := Data;
Result := Copy(Result, 1, MaxLen);
Result := StringOfChar(#0, (MaxLen - Length(Result)*Scale) div (2 * Scale)) + Result;
......@@ -5854,6 +5857,8 @@ var
XOffset: Integer;
begin
if Barcode.Alignment = BARCODE_ALIGNMENT_LEFT then Exit;
if HScale = 0 then
raise Exception.Create('HScale = 0');
PrintWidthInDots := PrintWidthInDots div HScale;
XOffset := 0;
......@@ -6374,8 +6379,12 @@ const
BytesPerCommand = 240;
begin
Progress := 0;
LineLength := Length(GetLineData(Bitmap, 1));
RowsPerCommand := BytesPerCommand div LineLength;
LineLength := (Bitmap.Width + 7) div 8;
RowsPerCommand := 0;
if LineLength <> 0 then
RowsPerCommand := BytesPerCommand div LineLength;
if RowsPerCommand = 0 then
raise Exception.Create('RowsPerCommand = 0');
CommandCount := (Bitmap.Height + RowsPerCommand -1) div RowsPerCommand;
ProgressStep := CommandCount/100;
Row := 0;
......@@ -7335,6 +7344,9 @@ end;
function TFiscalPrinterDevice.GetBlockSize(BlockSize: Integer): Integer;
begin
Result := BlockSize;
if Result = 0 then
Result := DefDocumentBlockSize;
if (GetDeviceMetrics.Model = 19)and(BlockSize > GetParameters.DocumentBlockSize) then
Result := GetParameters.DocumentBlockSize;
end;
......
No preview for this file type
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment