public static void Stop() { // выходим в режим выбора, чтобы кто-то под введенными паролями не сделал что нибуть нехорошее if (ECR.ResetMode() != 0) { return; } // освобождаем порт ECR.DeviceEnabled = false; if (ECR.ResultCode != 0) { return; } }
private void Initialize() { try { Log("Инициализация"); FSettings = new FiscalSettings(); FSettings.SettingsChanged += new FiscalSettings.SettingsChangedEventHandler(FSettings_SettingsChanged); FSettings.Event(); KKM = new FprnM1C.FprnM45Class(); SetDeviceInfo(GetModel(KKM.Model), "АТОЛ V" + KKM.Version, KKM.UMajorVersion.ToString() + "." + KKM.UMinorVersion.ToString() + "." + KKM.UBuild, "COM" + KKM.PortNumber.ToString(), DeviceType.FiscalRegister); KKM.DeviceEnabled = true; Log("Получение статуса"); if (!Execute(KKM.GetStatus())) { throw new Exception("Не удалось найти устройство КММ. \r\n"); } if (KKM.CheckState != 0) { Log("Чек не закрыт, закрываем чек"); /*if (KKM.CancelCheck() != 0) * { * Log("Не удалось закрыть чек."); * return false; * }*/ ClosePayment(); } Log("ResetMode()"); Execute(KKM.ResetMode()); KKM.TextWrap = 1; } catch (Exception ex) { throw new Exception("Не удалось создать объект общего драйвера КММ `АТОЛ`.\r\n- " + ex.Message); } }
public override bool ClosePayment() { Log("Закрытие чека"); KKM.TypeClose = 0; if (!Execute(KKM.CloseCheck())) { return(false); } Log("ResetMode()"); if (!Execute(KKM.ResetMode())) { return(false); } // _paymentOpened = false; return(true); }
private bool PayAtol(double cash, double card, string cashier = "Кассир", int numCheck = -1, int numSession = 0, bool vozvrat = false) { if (!SetDevice()) { return(false); } ECR.Mode = 1; if (ECR.SetMode() != 0) { MessageBox.Show(ECR.ResultDescription); return(false); } ECR.AttrNumber = 1021; ECR.AttrValue = cashier; if (ECR.WriteAttribute() != 0) { MessageBox.Show(ECR.ResultDescription); return(false); } numCheck = ECR.CheckNumber; numSession = ECR.Session; int num = 1; foreach (DataGridViewRow item in dataGridViewChecks.Rows) { ECR.Name = num.ToString() + ". " + item.Cells["ColumnProduct"].Value.ToString(); ECR.Quantity = double.Parse(item.Cells["ColumnQty"].Value.ToString()); //ECR.Department = Отдел; ECR.TaxTypeNumber = int.Parse(item.Cells["ColumnNDSValue"].Value.ToString()); ECR.Price = double.Parse(item.Cells["ColumnPrice"].Value.ToString()); ECR.Percents = double.Parse(item.Cells["ColumnDiscountValue"].Value.ToString()); ECR.DiscountValue = double.Parse(item.Cells["ColumnDiscountValue"].Value.ToString()); ECR.DiscountType = 1; ECR.DiscountTypeNumber = 1; if (!vozvrat) { if (ECR.Registration() != 0) { MessageBox.Show(ECR.ResultDescription); return(false); } } else { if (ECR.Return() != 0) { MessageBox.Show(ECR.ResultDescription); return(false); } } num++; } if (cash > 0) { ECR.Summ = cash; ECR.TypeClose = 0; ECR.Payment(); } if (card > 0) { ECR.Summ = card; ECR.TypeClose = 3; ECR.Payment(); } if (ECR.CloseCheck() != 0) { MessageBox.Show(ECR.ResultDescription); return(false); } if (ECR.ResetMode() != 0) { MessageBox.Show(ECR.ResultDescription); return(false); } ECR.DeviceEnabled = false; if (ECR.ResultCode != 0) { MessageBox.Show(ECR.ResultDescription); return(false); } return(true); }