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); }
public static void WriteAttribute(int AttrNumber, string AttrValue) { ECR.AttrNumber = AttrNumber; ECR.AttrValue = AttrValue; ECR.WriteAttribute(); }