Commit 682b7cdc authored by kravtsov's avatar kravtsov

[+] Добавлена поддержка записи данных о табачных изделиях

[+] Добавлен модификатор "-" для поля TITLE. Если он установлен,
    то все остальные поля выравниваются по правому краю.
parent 16678535
......@@ -4,6 +4,16 @@
Company : SHTRIH-M, Russia, Moscow, Masterkova 4
(495) 787-60-90, www.shtrih-m.ru
*******************************************************************
OposShtrih_1.13_477.exe
21 февраля 2018 19:15
[+] Добавлена поддержка записи данных о табачных изделиях
[+] Добавлен модификатор "-" для поля TITLE. Если он установлен,
то все остальные поля выравниваются по правому краю.
*******************************************************************
OposShtrih_1.13_476.exe
......
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,13,0,476
PRODUCTVERSION 1,13,0,476
FILEVERSION 1,13,0,477
PRODUCTVERSION 1,13,0,477
FILEFLAGSMASK 0x3fL
FILEFLAGS 0x0L
FILEOS 0x4L
......@@ -13,7 +13,7 @@ BEGIN
BEGIN
VALUE "CompanyName", "SHTRIH-M\0"
VALUE "FileDescription", "OPOS setup utility\0"
VALUE "FileVersion", "1.13.0.476\0"
VALUE "FileVersion", "1.13.0.477\0"
VALUE "InternalName", "OPOS setup \0"
VALUE "LegalCopyright", "SHTRIH-M \251 2013 \0"
VALUE "OriginalFilename", "OposConfig.exe\0"
......
[Closed Files]
File_0=SourceModule,'C:\projects\OPOSShtrih\Source\OposTest\Units\PrinterTest.pas',0,1,4563,3,4606,0,0
File_1=SourceModule,'C:\projects\OPOSShtrih\Source\OposTest\Fmu\fmuFptrReceiptTest.pas',0,1,100,5,112,0,0
File_2=SourceModule,'C:\projects\OPOSShtrih\Source\Opos\SMFiscalPrinter.pas',0,1,1636,1,1655,0,0
File_3=SourceModule,'C:\projects\OPOSShtrih\Source\SmFiscalPrinter\Units\FiscalPrinterDevice.pas',0,1,1,1,1,0,0
File_4=SourceModule,'C:\projects\OPOSShtrih\Source\SmFiscalPrinter\Units\FSSalesReceipt.pas',0,1,1,26,6,0,0
File_5=SourceModule,'C:\projects\OPOSShtrih\Source\SmFiscalPrinter\Units\PrinterParameters.pas',0,1,1,23,23,0,0
File_6=SourceModule,'C:\projects\OPOSShtrih\Source\SmFiscalPrinter\Units\SharedPrinter.pas',0,1,1072,2,1091,0,0
File_7=SourceModule,'C:\projects\OPOSShtrih\Source\SmFiscalPrinter\Units\DirectIOAPI.pas',0,1,1,15,30,0,0
File_8=SourceModule,'C:\projects\OPOSShtrih\Source\SmFiscalPrinter\Units\FiscalPrinterImpl.pas',0,1,4175,2,4177,0,0
File_9=SourceModule,'C:\projects\OPOSShtrih\Source\Shared\DIOHandlers.pas',0,1,69,15,70,0,0
File_0=SourceModule,'C:\projects\OPOSShtrih\Source\SmScale\Units\oleScale.pas',0,1,1,17,12,0,0
File_1=SourceModule,'C:\projects\OPOSShtrih\Source\SmScale\Units\ScaleDriver.pas',0,1,1,23,12,0,0
File_2=SourceModule,'C:\projects\OPOSShtrih\Source\SmScale\Units\M5ScaleDevice.pas',0,1,440,1,457,0,0
File_3=SourceModule,'C:\projects\OPOSShtrih\Source\SmScale\Units\M5OposDevice.pas',0,1,1,1,1,0,0
File_4=SourceModule,'C:\projects\OPOSShtrih\Source\SmScale\Units\M5ScaleTypes.pas',0,1,27,1,41,0,0
File_5=SourceModule,'C:\projects\OPOSShtrih\Source\SmScale\Units\OposDevice.pas',0,1,1,1,1,0,0
File_6=SourceModule,'C:\projects\OPOSShtrih\Source\Shared\LogFile.pas',0,1,636,1,659,0,0
File_7=SourceModule,'c:\program files (x86)\borland\delphi7\Comp\FastMM\FastMM4.pas',0,1,8698,1,8719,0,0
File_8=SourceModule,'C:\projects\OPOSShtrih\Test\SmFiscalPrinterTest\Units\duLogFile.pas',0,1,125,51,128,0,0
File_9=SourceModule,'C:\projects\OPOSShtrih\Source\Shared\FileUtils.pas',0,1,150,5,156,0,0
[Modules]
Count=0
EditWindowCount=0
TypeLibWindowCount=3
[C:\projects\OPOSShtrih\Test\SmScaleTest\SmScaleTestLib.dpr]
FormState=0
FormOnTop=0
[C:\projects\OPOSShtrih\Source\OposShtrih.bpg]
FormState=0
FormOnTop=0
......@@ -87,10 +91,6 @@ FormOnTop=0
FormState=0
FormOnTop=0
[C:\projects\OPOSShtrih\Test\SmScaleTest\SmScaleTestLib.dpr]
FormState=0
FormOnTop=0
[TypeLibEditWindow0]
Create=1
Visible=0
......@@ -188,11 +188,11 @@ State=0
Left=8
Top=124
Width=650
Height=498
Height=558
MaxLeft=-1
MaxTop=-1
ClientWidth=634
ClientHeight=464
ClientHeight=524
TBDockHeight=681
LRDockWidth=445
Dockable=0
......@@ -418,5 +418,5 @@ CompUnitPane=104
DockHostCount=0
[ActiveProject]
ActiveProject=1
ActiveProject=5
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,13,0,476
PRODUCTVERSION 1,13,0,476
FILEVERSION 1,13,0,477
PRODUCTVERSION 1,13,0,477
FILEFLAGSMASK 0x3fL
FILEFLAGS 0x0L
FILEOS 0x4L
......@@ -13,7 +13,7 @@ BEGIN
BEGIN
VALUE "CompanyName", "SHTRIH-M\0"
VALUE "FileDescription", "OPOS test utility\0"
VALUE "FileVersion", "1.13.0.476\0"
VALUE "FileVersion", "1.13.0.477\0"
VALUE "InternalName", "OPOS test\0"
VALUE "LegalCopyright", "SHTRIH-M \251 2013 \0"
VALUE "OriginalFilename", "OposTest.exe\0"
......
......@@ -4452,7 +4452,7 @@ end;
function TReceiptTest16.GetDisplayText: string;
begin
Result := 'ReceiptTest16';
Result := 'Test multiline text in printRecItem method';
end;
procedure TReceiptTest16.Execute;
......
......@@ -7,7 +7,7 @@ uses
DeviceService;
const
GenericServiceVersion = deviceVersion113 + 476;
GenericServiceVersion = deviceVersion113 + 477;
implementation
......
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,13,0,476
PRODUCTVERSION 1,13,0,476
FILEVERSION 1,13,0,477
PRODUCTVERSION 1,13,0,477
FILEFLAGSMASK 0x3fL
FILEFLAGS 0x0L
FILEOS 0x4L
......@@ -13,7 +13,7 @@ BEGIN
BEGIN
VALUE "CompanyName", "SHTRIH-M\0"
VALUE "FileDescription", "Fiscal printer service\0"
VALUE "FileVersion", "1.13.0.476\0"
VALUE "FileVersion", "1.13.0.477\0"
VALUE "InternalName", "Fiscal printer driver\0"
VALUE "LegalCopyright", "SHTRIH-M \251 2013 \0"
VALUE "OriginalFilename", "SmFiscalPrinter.dll\0"
......
......@@ -201,7 +201,7 @@ begin
FReceiptItems := TReceiptItems.Create;
ClearReceipt;
FTemplate := TReceiptTemplate.Create;
FTemplate := TReceiptTemplate.Create(Device.GetPrintWidth);
FTemplate.Template := AContext.Printer.Printer.Parameters.ReceiptItemFormat;
end;
......
......@@ -8699,8 +8699,6 @@ var
begin
Result := 0;
if Barcode = '' then Exit;
if not MarkType in [2, 3] then Exit;
Data := GS1DecodeBraces(Barcode);
Data := GS1FilterTockens(Data);
GS1Barcode := DecodeGS1(Data);
......@@ -8714,12 +8712,18 @@ begin
Data := #$00#$02 + GTIN + TTLVTag.ASCII2ValueTLV(Serial);
Data := TTLVTag.Int2ValueTLV(1162, 2) + TTLVTag.Int2ValueTLV(Length(Data), 2) + Data;
end;
3:
begin //
Serial := Copy(GS1Barcode.Serial, 1, 13);
Serial := Serial + StringOfChar(' ', 13 - Length(Serial));
Data := #$00#$03 + TTLVTag.ASCII2ValueTLV(Serial) + GTIN;
Data := #$00#$03 + GTIN + TTLVTag.ASCII2ValueTLV(Serial);
Data := TTLVTag.Int2ValueTLV(1162, 2) + TTLVTag.Int2ValueTLV(Length(Data), 2) + Data;
end;
5:
begin //
Serial := Copy(GS1Barcode.Serial, 1, 24);
Serial := Serial + StringOfChar(' ', 24 - Length(Serial));
Data := #$00#$05 + GTIN + TTLVTag.ASCII2ValueTLV(Serial);
Data := TTLVTag.Int2ValueTLV(1162, 2) + TTLVTag.Int2ValueTLV(Length(Data), 2) + Data;
end;
else
......
......@@ -20,6 +20,7 @@ type
Prefix: string;
Length: Integer;
Alignment: TFieldAlignment;
IsSpacer: Boolean;
end;
{ TReceiptTemplate }
......@@ -27,9 +28,12 @@ type
TReceiptTemplate = class
private
FTemplate: string;
FPrintWidth: Integer;
function GetFieldValue(const Field, Prefix: string;
const Item: TFSSaleItem): string;
const Item: TFSSaleItem; var IsSpacer: Boolean): string;
public
constructor Create(APrintWidth: Integer);
function getItemText(const Item: TFSSaleItem): string;
function ParseField(const Field: string): TTemplateFieldRec;
function ParseField2(const Field: string): TTemplateFieldRec;
......@@ -42,6 +46,13 @@ implementation
{ TReceiptTemplate }
constructor TReceiptTemplate.Create(APrintWidth: Integer);
begin
inherited Create;
FPrintWidth := APrintWidth;
end;
// %51lTITLE%;%8lPRICE% %6lDISCOUNT% %8lSUM% %3QUAN% %=$10TOTAL_TAX%
function TReceiptTemplate.GetText(const FormatLine: string;
const Item: TFSSaleItem): string;
......@@ -50,10 +61,14 @@ type
var
C: Char;
i: Integer;
Line: string;
Field: string;
Prefix: string;
Count: Integer;
IsSpacer: Boolean;
State: TParserState;
begin
Line := '';
Field := '';
Prefix := '';
Result := '';
......@@ -68,7 +83,12 @@ begin
case State of
stField:
begin
Result := Result + GetFieldValue(Field, Prefix, Item);
Result := Result + GetFieldValue(Field, Prefix, Item, IsSpacer);
if IsSpacer then
begin
Line := Result;
Result := '';
end;
State := stChar;
end;
stESC:
......@@ -85,7 +105,7 @@ begin
else
if State = stField then
begin
if (Field = '')and (not IsCharAlphaNumeric(C)) then
if (Field = '')and (C <> '-')and(not IsCharAlphaNumeric(C)) then
begin
Prefix := Prefix + C;
end else
......@@ -99,6 +119,11 @@ begin
end;
end;
end;
if Line <> '' then
begin
Count := FPrintWidth - ((Length(Line) + Length(Result)) mod FPrintWidth);
Result := Line + StringOfChar(' ', Count) + Result;
end;
end;
function GetTaxLetter(Tax: Integer): string;
......@@ -114,7 +139,7 @@ end;
function TReceiptTemplate.GetFieldValue(const Field, Prefix: string;
const Item: TFSSaleItem): string;
const Item: TFSSaleItem; var IsSpacer: Boolean): string;
var
L: Integer;
TaxLetter: string;
......@@ -122,6 +147,8 @@ var
begin
Result := '';
FieldData := ParseField(Field);
IsSpacer := FieldData.IsSpacer;
if AnsiCompareText(FieldData.Name, 'TITLE') = 0 then
begin
Result := Item.Text;
......@@ -206,6 +233,7 @@ var
begin
Result.Name := '';
Result.Length := 0;
Result.IsSpacer := False;
Result.Alignment := faRight;
Text := '';
......@@ -222,6 +250,10 @@ begin
end;
Text := Text + C;
end;
'-':
begin
Result.IsSpacer := True;
end;
'c', 'l':
begin
case State of
......@@ -270,9 +302,6 @@ begin
Lines := TStringList.Create;
TemplateLines := TStringList.Create;
try
if Item.PreLine <> '' then
Lines.Add(Item.PreLine);
if Item.Quantity < 0 then
begin
Lines.Add('');
......@@ -284,9 +313,6 @@ begin
Lines.Add(GetText(TemplateLines[i], Item));
end;
if Item.PostLine <> '' then
Lines.Add(Item.PostLine);
Result := Lines.Text;
finally
Lines.Free;
......
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,13,0,476
PRODUCTVERSION 1,13,0,476
FILEVERSION 1,13,0,477
PRODUCTVERSION 1,13,0,477
FILEFLAGSMASK 0x3fL
FILEFLAGS 0x0L
FILEOS 0x4L
......@@ -13,7 +13,7 @@ BEGIN
BEGIN
VALUE "CompanyName", "SHTRIH-M\0"
VALUE "FileDescription", "Fiscal printer print server\0"
VALUE "FileVersion", "1.13.0.476\0"
VALUE "FileVersion", "1.13.0.477\0"
VALUE "InternalName", "Fiscal printer driver\0"
VALUE "LegalCopyright", "SHTRIH-M \251 2013 \0"
VALUE "OriginalFilename", "SmFptrSrv.exe\0"
......
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,13,0,476
PRODUCTVERSION 1,13,0,476
FILEVERSION 1,13,0,477
PRODUCTVERSION 1,13,0,477
FILEFLAGSMASK 0x3fL
FILEFLAGS 0x0L
FILEOS 0x4L
......@@ -13,7 +13,7 @@ BEGIN
BEGIN
VALUE "CompanyName", "SHTRIH-M\0"
VALUE "FileDescription", "Scale service\0"
VALUE "FileVersion", "1.13.0.476\0"
VALUE "FileVersion", "1.13.0.477\0"
VALUE "InternalName", "Scale driver\0"
VALUE "LegalCopyright", "SHTRIH-M \251 2013 \0"
VALUE "OriginalFilename", "SmScale.dll\0"
......
......@@ -33,12 +33,12 @@ TStringUtilsTest=0
TRetalixTest=0
TDateTimeTest=0
TTemplateItemTest=1
TReceiptTemplateTest=0
TReceiptTemplateTest=1
TResourceStringTest=1
TBitTest=0
TICMPClientTest=1
TSocketPortTest=0
TLogFileTest=1
TLogFileTest=0
[Tests.SmFiscalPrinterTest.exe.TOposStatisticsTest]
CheckReset=1
CheckUpdate=1
......@@ -251,7 +251,7 @@ Width=1361
Height=808
Maximized=0
UseRegistry=0
ResultsPanel.Height=282
ResultsPanel.Height=136
ErrorMessage.Height=200
ErrorMessage.Visible=1
FailureList.ColumnWidth[0]=241
......@@ -574,9 +574,9 @@ CheckDateUtils=0
[Tests.SmFiscalPrinterTest.exe.TTemplateItemTest]
GetNextTag=1
[Tests.SmFiscalPrinterTest.exe.TReceiptTemplateTest]
CheckGetText=0
CheckParseField=0
CheckParseField2=0
CheckGetText=1
CheckParseField=1
CheckParseField2=1
[Tests.SmFiscalPrinterTest.exe.TResourceStringTest]
CheckStrings=1
[Tests.SmFiscalPrinterTest.exe.TBitTest]
......@@ -587,5 +587,5 @@ CheckPing=1
[Tests.SmFiscalPrinterTest.exe.TSocketPortTest]
CheckOpen=1
[Tests.SmFiscalPrinterTest.exe.TLogFileTest]
CheckDeleteFile=1
CheckMaxCount=1
CheckDeleteFile=0
CheckMaxCount=0
......@@ -31,7 +31,7 @@ implementation
procedure TReceiptTemplateTest.Setup;
begin
Template := TReceiptTemplate.Create;
Template := TReceiptTemplate.Create(42);
end;
procedure TReceiptTemplateTest.Teardown;
......@@ -63,6 +63,18 @@ begin
Text := Template.getText('%TITLE%', Item);
CheckEquals(Item.Text, Text, 'Item.Text');
Item.Text := 'ajdshgjasghd86876234';
Text := Template.getText('%-TITLE%', Item);
CheckEquals('ajdshgjasghd86876234 ', Text, 'Item.Text');
Item.Text := 'ajdshgjasghd86876234';
Text := Template.getText('%-lTITLE%', Item);
CheckEquals('ajdshgjasghd86876234 ', Text, 'Item.Text');
Item.Text := 'ajdshgjasghd86876234';
Text := Template.getText('%-30lTITLE%', Item);
CheckEquals('ajdshgjasghd86876234 ', Text, 'Item.Text');
Item.Pos := 234;
Text := Template.getText('%POS%', Item);
CheckEquals('234', Text, 'POS');
......
No preview for this file type
[releases]
current=1.13.0.476
current=1.13.0.477
last_date=2010-02-05
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