private BillDetail GetItemById(string id) { var stock = new BillDetail(); if ("1201".Equals(id)) { stock.code = id; stock.name = "Талх"; stock.measureUnit = "ш"; stock.qty = "3.00"; stock.unitPrice = "1000.00"; stock.totalAmount = "3900"; stock.vat = "100"; stock.barCode = "156266"; stock.cityTax = "0.00"; } else if ("1202".Equals(id)) { stock.code = id; stock.name = "Цамц"; stock.measureUnit = "ш"; stock.qty = "1.00"; stock.unitPrice = "45000.00"; stock.totalAmount = "45000.00"; stock.vat = "4500.00"; stock.barCode = "156266"; stock.cityTax = "0.00"; } else if ("1000".Equals(id)) { stock.code = id; stock.name = "Сүү"; stock.measureUnit = "л"; stock.qty = "1.00"; stock.unitPrice = "980.00"; stock.totalAmount = "980.00"; stock.vat = "100.00"; stock.barCode = "156266"; stock.cityTax = "0.00"; } else if ("1001".Equals(id)) { stock.code = id; stock.name = "Архи-Ex"; stock.measureUnit = "ш"; stock.qty = "1.00"; stock.unitPrice = "20000.00"; stock.totalAmount = "20000.00"; stock.vat = "2000.00"; stock.barCode = "0124652"; stock.cityTax = (Convert.ToDouble(stock.unitPrice) * 0.01).ToString(Program.NUMBER_FORMAT); } else if ("1002".Equals(id)) { stock.code = id; stock.name = "Гуляш"; stock.measureUnit = "ш"; stock.qty = "1.00"; stock.unitPrice = "4000.00"; stock.totalAmount = "4000.00"; stock.vat = "400.00"; stock.barCode = "01246526"; stock.cityTax = "0.00"; } else if ("2001".Equals(id)) { stock.code = id; stock.name = "Тамхи Esse"; stock.measureUnit = "ш"; stock.qty = "1.00"; stock.unitPrice = "3500.00"; stock.totalAmount = "3500.00"; stock.vat = "350.00"; stock.barCode = "012465233"; stock.cityTax = (Convert.ToDouble(stock.unitPrice) * 0.01).ToString(Program.NUMBER_FORMAT); } else if ("2002".Equals(id)) { stock.code = id; stock.name = "Magna"; stock.measureUnit = "ш"; stock.qty = "1.00"; stock.unitPrice = "2500.00"; stock.totalAmount = "2500.00"; stock.vat = "250.00"; stock.barCode = "012465233"; stock.cityTax = (Convert.ToDouble(stock.unitPrice) * 0.01).ToString(Program.NUMBER_FORMAT); } ///////------------------------------- else if ("3000".Equals(id)) { stock.code = id; stock.name = "Mild Seven Blue"; stock.measureUnit = "ш"; stock.qty = "1.00"; stock.unitPrice = "4440.00"; stock.totalAmount = "4440.00"; stock.vat = "400.00"; stock.barCode = "122004"; stock.cityTax = "40.00"; } else if ("3001".Equals(id)) { stock.code = id; stock.name = "Magna"; stock.measureUnit = "ш"; stock.qty = "1.00"; stock.unitPrice = "2500.00"; stock.totalAmount = "2500.00"; stock.vat = "250.00"; stock.barCode = "012465233"; stock.cityTax = "22.52"; } else if ("3002".Equals(id)) { stock.code = id; stock.name = "Алим"; stock.measureUnit = "кг"; stock.qty = "1.00"; stock.unitPrice = "6050.00"; stock.totalAmount = "6050.00"; stock.vat = "550.00"; stock.barCode = "1232001"; stock.cityTax = "0.00"; } else if ("3003".Equals(id)) { stock.code = id; stock.name = "Кока кола"; stock.measureUnit = "ш"; stock.qty = "1.00"; stock.unitPrice = "2640.00"; stock.totalAmount = "2640.00"; stock.vat = "240.00"; stock.barCode = "655002"; stock.cityTax = "0.00"; } else if ("3004".Equals(id)) { stock.code = id; stock.name = "Болор архи 0,75"; stock.measureUnit = "ш"; stock.qty = "1.00"; stock.unitPrice = "22200.00"; stock.totalAmount = "22200.00"; stock.vat = "2000.00"; stock.barCode = "989003"; stock.cityTax = "200.00"; } else if ("3005".Equals(id)) { stock.code = id; stock.name = "Сайра загас"; stock.measureUnit = "ш"; stock.qty = "1.00"; stock.unitPrice = "4000.00"; stock.totalAmount = "4000.00"; stock.vat = "363.64"; stock.barCode = "9890031"; stock.cityTax = "0.00"; } else if ("3006".Equals(id)) { stock.code = id; stock.name = "Хар талх"; stock.measureUnit = "ш"; stock.qty = "1.00"; stock.unitPrice = "1600.00"; stock.totalAmount = "1600.00"; stock.vat = "145.45"; stock.barCode = "989003213"; stock.cityTax = "0.00"; } else if ("3007".Equals(id)) { stock.code = id; stock.name = "Шоколад Alpen-Gold"; stock.measureUnit = "ш"; stock.qty = "1.00"; stock.unitPrice = "1700.00"; stock.totalAmount = "1700.00"; stock.vat = "154.54"; stock.barCode = "989003121"; stock.cityTax = "0.00"; } else if ("3008".Equals(id)) { stock.code = id; stock.name = "Сүү"; stock.measureUnit = "л"; stock.qty = "1.00"; stock.unitPrice = "2000.00"; stock.totalAmount = "2000.00"; stock.vat = "181.82"; stock.barCode = "98900388"; stock.cityTax = "0.00"; } return stock; }
/// <summary> /// Гүйлгээний мэдээллийг JSON форматанд хөрвүүлэн /// сугалаа,баримтын дугаар, QR код г.м мэдээллийг үүсгэнэ /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void buttonCreateBill_Click(object sender, EventArgs e) { var data = new BillData(); data.posNo = textBoxPosNo.Text; data.amount = textBoxAmount.Text; data.vat = textBoxVat.Text; data.cashAmount = textBoxCash.Text; data.nonCashAmount = textBoxNonCash.Text; data.billIdSuffix = textBoxNumber.Text; var lstBillStock = new List<BillDetail>(); foreach (DataGridViewRow row in dataGridViewStocks.Rows) { if (!row.IsNewRow) { var stock = new BillDetail(); stock.code = row.Cells["Code"].Value.ToString(); stock.name = row.Cells["ItemName"].Value.ToString(); stock.measureUnit = row.Cells["MeasureUnit"].Value.ToString(); stock.qty = row.Cells["Qty"].Value.ToString(); stock.unitPrice = row.Cells["UnitPriceNonVat"].Value.ToString(); stock.totalAmount = row.Cells["Amount"].Value.ToString(); stock.vat = row.Cells["Vat"].Value.ToString(); stock.barCode = row.Cells["BarCode"].Value.ToString(); stock.cityTax = row.Cells["CityTax"].Value.ToString(); lstBillStock.Add(stock); } } data.cityTax = textBoxCityTax.Text; data.bankTransactions = this.ListBankTranscation; if (lstBillStock.Count == 0) { lstBillStock = null; } data.stocks = lstBillStock; data.districtCode = textBoxDistrict.Text; var json = new JavaScriptSerializer().Serialize(data); var result = Program.put(json); this.resultData = new JavaScriptSerializer().Deserialize<Result>(result); if ("True".Equals(this.resultData.success.ToString())) { print(); } else { MessageBox.Show(resultData.message); } }