static void PrintFiscalString(FiscalString fs) { Log("FiscalString"); string Name = fs.Name; Log("Name=" + Name); double Price = fs.Price; double Quantity = fs.Quantity; double Amount = fs.Amount; int Tax = AtolGetTaxByString(fs.Tax); if (Tax == -1) { Log("Tax = " + fs.Tax); FR.Abort(); return; } int Department = Convert.ToInt32(fs.Department); int DiscountType = 0; double DiscontValue = 0; Log("Registration: Name=" + Name + " Price=" + Price + " Quantity=" + Quantity + " Tax=" + Tax); FR.Registration(Name, Price, Quantity, Tax, Department, DiscountType, DiscontValue); }
static void ProcessCheck(CheckPackage checkPackage) { int Result; if (checkPackage.Positions.Items.Length == 0) { Log("Positions = 0"); return; } Log("ProcessCheck"); Log("Positions = " + checkPackage.Positions.Items.Length); FR.Start(); Log("SetMode "); Result = FR.SetMode(1, "30"); Log("Result = " + Result); if (Result == -3822) { FR.PrintString("Смена превысила 24 часа!"); FR.PrintString("Для продолжения снимите Z-Отчет."); FR.Feed(6); FR.PartialCut(); FR.Stop(); return; } int CheckMode = 1; int CheckType = Convert.ToInt32(checkPackage.Parameters.PaymentType); Log("OpenCheck CheckMode=" + CheckMode + " CheckType=" + CheckType); Result = FR.OpenCheck(CheckMode, CheckType); Log("Result = " + Result); // Применяемая система налогооблажения в чеке: long TaxVariant = AtolGetTaxVariantByLong(checkPackage.Parameters.TaxVariant); FR.WriteAttribute(1055, TaxVariant.ToString()); // Позиции чека for (int i = 0; i < checkPackage.Positions.Items.Length; i++) { if (checkPackage.Positions.ItemsElementName[i] == ItemsChoiceType.FiscalString) { PrintFiscalString((FiscalString)checkPackage.Positions.Items[i]); } else if (checkPackage.Positions.ItemsElementName[i] == ItemsChoiceType.TextString) { PrintTextString((TextString)checkPackage.Positions.Items[i]); } else if (checkPackage.Positions.ItemsElementName[i] == ItemsChoiceType.BarcodeString) { PrintBarcodeString((BarcodeString)checkPackage.Positions.Items[i]); } else { Log("Unknown position " + checkPackage.Positions.Items[i].ToString()); } } // Оплата Log("Payment"); double Cash = checkPackage.Payments.Cash; double CashLessType1 = checkPackage.Payments.CashLessType1; double CashLessType2 = checkPackage.Payments.CashLessType2; double CashLessType3 = checkPackage.Payments.CashLessType3; Log("Cash = " + Cash.ToString() + " CashLessType1 = " + CashLessType1.ToString() + " CashLessType2 = " + CashLessType2.ToString() + " CashLessType3 = " + CashLessType3.ToString()); double Remainder = 0; double Change = 0; FR.Payment(Cash, 0, ref Remainder, ref Change); FR.Payment(CashLessType1, 1, ref Remainder, ref Change); FR.Payment(CashLessType2, 2, ref Remainder, ref Change); FR.Payment(CashLessType3, 3, ref Remainder, ref Change); Log("CloseCheck"); Result = FR.CloseCheck(); Log("Result = " + Result); string ResultDescription = FR.ResultDescription(); if (Result != 0) { Log("Error: " + Result.ToString() + " - " + ResultDescription); FR.PrintString("Error: " + Result.ToString() + " - " + ResultDescription); Log("Abort"); FR.Abort(); } Log("Stop"); FR.Stop(); }