Answer the question
In order to leave comments, you need to log in
Kkm Server. Printing a receipt of goods. How to register a product and a QR code in a receipt?
We use the KKM Server API to print a receipt. How to connect to the KKM system correctly. Below is an example of the code that we use, we found it in the API example on the official KKM website. When it is launched, a canceled check without goods is printed. The QR code is also not printed.
Printing is performed by pressing the button:
```
Printing a receipt
```
Here is the handler code:
```
function ExecuteSuccess(result) {
$('#kkm-result').html(JSON.stringify( result));
}
// Printing a receipt
function RegisterCheck(NumDevice, TypeCheck, IsBarCode, Print) {
// Preparing command data, parameters (TypeCheck = 0, NumDevice = 0, InnKkm = "", CashierName = "")
var Data = KkmServer.GetDataCheck(TypeCheck, NumDevice, "", "Kazakova N.A.", "430601071197");
Data.NumDevice = NumDevice;
Data.InnKkm = "";
Data.KktNumber = "";
Data.Timeout = 30;
// Is this a fiscal or non-fiscal check
Data.IsFiscalCheck = true;
// Receipt type;
// 0 - sale; 10 - purchase;
// 1 - sale return; 11 - return of purchase;
// 8 - sale only by EGAIS (regular cash register receipt is not printed)
// 9 - sale return only by EGAIS (regular cash register receipt is not printed)
Data.TypeCheck = TypeCheck;
// Don't print check on paper
Data.NotPrint = false; //true,
// Number of document copies
Data.NumberCopies = 0;
// Seller, OFD tag 1021
Data.CashierName = "Kazakova N.A.";
// Seller's TIN OFD tag 1203
Data.CashierVATIN = "430601071197";
Data.ClientAddress = "[email protected]";
Data.ClientInfo = "Lucky VV PE-125486";
Data.ClientINN = "502906602876";
Data.SenderEmail = "[email protected]";
Data.PlaceMarket = "kkmserver.ru";
Data.TaxVariant = "";
// Additional user attribute OFD tag 1084
Data.
Name: "Field-test",
// Value of additional user attribute OFD tag 1086
Value: "Test value"
};
// Additional check attribute tag 1192
Data.AdditionalAttribute = "Test";
Data.KPP = "782543005";
Data.PayByProcessing = false; //Automatic acquiring is disabled in the test check
// Device number for acquiring - Null - from the settings on the server, 0 - any number, number - number of a specific device
Data.NumDeviceByProcessing = null;
// Receipt number for acquiring
Data.ReceiptNumber = "TEST-1";
// Print Slip check after the check (and not in the check)
PrintSlipAfterCheck = false;
// Print Slip check additionally for the cashier (the main slip check will already be printed as part of the check)
Data.PrintSlipForCashier = true;
//If this is a refund check, then two fields are possible for canceling the transaction (if not specified, then the acquiring will not cancel but refund the payment)
Data.RRNCode = ""; // RRNCode from the acquiring operation. Only for payment cancellation! For Payment or refund of payment, do not fill out!
Data.AuthorizationCode = ""; // AuthorizationCode from the acquiring operation. Only for payment cancellation! For Payment or refund of payment, do not fill out!
// Adding attributes for the agent and supplier
Data.AddDataAgent(
2,
// Payment agent operation tag 1044
"95315",
// Paying agent's phone tag 1073
"+79995554422",
// Payment acceptance operator's phone tag 1074
"+72223334455",
// Transfer operator's phone tag 1075
"+74447776655",
// Transfer operator's name tag 1026
"LLC Test organization" ,
// Address of the transfer operator tag 1005
"Moscow, Zubovsky Boulevard 44",
// TIN of the transfer operator tag 1016
"430601071197",
// Supplier's phone number tag 1171
"+76662229955"
);
// Adding text-by-field printing
//When inserting the characters ">#10#<" into the text, the string will be aligned in the center when printed, where 10 is how much less the CCP string will become
Data.AddTextString(">#2#<OOO \"Horns and hooves\"" , one);
// When inserted into the text in the middle of the character string "<#10#>" The left side of the string will be aligned to the left, the right to the right, where 10 is how much the CCT string will become smaller
// When inserted into the text in the middle of the character string "<#10#>>" The left side of the string will be right-aligned, the right side right-aligned, where 10 is the indent from the right clay
Data.AddTextString("<<->>");
Data.AddTextString("
Data.AddTextString("<<->>");
Data.AddTextString("Example #2:<#8#>>4.00");
Data.AddTextString("2nd field:<#8#>>1544.00");
Data.AddTextString("<<->>");
Data.AddTextString("Font #1", 1, 15);
Data.AddTextString("Font #2", 2, 10);
Data.AddTextString("Font #3", 3, 5);
Data.AddTextString("Font #4", 4, 15);
Data.AddTextString("<<->>");
// Adding a print of the fiscal string
var DataStr = Data.AddRegisterString(
// ProductName(64 characters)
"Women's boots DF-3099-1",
1,
// Line Amount (2 decimal places)
0.01,
// VAT Rate(0(VAT 0%), 10(VAT 10%), 20(VAT 20%), -1(VAT 20% free), 120 (VAT 20 /120), 110 (VAT 10/110))
-1,
// Department
0,
// Product code EAN13 - optional
"1254789547853",
4,
1,
"0104300943734342212413195240818240640291ffd092MDEwNDMwMDk0MzczNDM",
// Calculation item unit.
"Pair" may be omitted ,
// Numerical code of the country of origin of the goods (CountryOfOrigin) in accordance with the All-Russian Classifier of Countries of the World 3 char. Tag 1230
"156",
// Registration number of the customs declaration (CustomsDeclaration) 32 characters. Tag 1231
"54180656/1345865/3435625/23",
// Excise amount (ExciseAmount), including kopecks, included in the cost of the subject of calculation Tag 1229
0.01,
// Additional attribute of the subject of settlement tag 1191, Only for FFD 1.1 !
"Test-additional details"
);
// DataStr.EGAIS = {
// Barcode: "22N0000154NUCPRZ3R8381461004001003499NKAQ0ZBUVDNV62JQAR69PEV878RO93V",
// Ean: "3423290167937",
// Volume: 0.7500,
// };
Data.AddAgentSign(2);
// Adds agent data to the last line (optional)
Data.AddAgentData(
// Payment agent operation tag 1044
"95315",
// Payment agent phone number tag 1073
"+79995554422",
// Payment acceptance operator phone number tag 1074
"+72223334455",
// Transfer operator phone number tag 1075
"+ 74447776655",
// Name of the transfer operator tag 1026
"LLC Horns and Hooves",
// Address of the transfer operator tag 1005
"Moscow, Zubovsky Boulevard 44",
// TIN of the transfer operator tag 1016
"430601071197"
);
// Adds vendor data to the last line (optional)
Data.AddPurveyorData(
// Supplier's phone number tag 1171
"+76662229955",
// Supplier's name OFD 1225
"LLC 'Garazhik in the village'",
// Supplier's TIN tag 1226
"430601071197"
);
// Adding barcode printing
// Data.AddBarcodeString(BarcodeType("EAN13", "CODE39", "CODE128", "QR", "PDF417", "1254789547853"), Barcode);
Data.AddBarcodeString("EAN13", "1254789547853");
Data.AddTextString("<<->>");
Data.AddTextString("This is a mega cool product. Sold in all stores in the country.
Data.AddRegisterString("Men's red trousers: NIMBUS-2000", 1, 1, 0.01, 1, 1, "1254789547853", 1, 1);
// Adds the Item Code to the last line
Data.AddGoodCodeData("02", "04630037591316", "sgEdK2y5");
// Cash payment (2 decimal places)
Data.Cash = 100;
// Electronic payment amount (2 decimal places)
Data.ElectronicPayment = 0.01;
// Amount from prepayment (with advance payment) (2 decimal places)
Data.AdvancePayment = 0;
// Postpaid amount (on credit) (2 decimal places)
Data.Credit = 0;
// Amount of payment by counter provision (certificates, other financial values) (2 decimal places)
Data.CashProvision = 0;
//#if Release
// Throwing off the data about the agent - because your CCP is not registered as an Agent.
Data.AgentSign = null;
Data.AgentData = null;
Data.PurveyorData = null;
//#endif
for (var i = 0; i < Data.CheckStrings.length; i++) {
if (Data.CheckStrings[i] != undefined && Data.CheckStrings[i].Register != undefined) {
Data.CheckStrings [i].Register.AgentSign = null;
Data.CheckStrings[i].Register.AgentData = null;
Data.CheckStrings[i].Register.PurveyorData = null;
};
};
}
```
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question