private void OtherCharges_KeyDown(object sender, KeyEventArgs e) { if (e.Key == Key.Enter) { this.CalculateNetAmount(); SGST.Focus(); } }
static void AddToGridByDate(DataGridView grid, M2OrderItem item, M2OrderByDatesItems invoice, M2OrderByDateBillingAddress billingAddress) { try { string sku = item.sku; double CGST, SGST, BASE_AMOUNT, RateBasic, DeliveryCharge, BaseDiscountAmount, LineAmount, InvoiceAmount; string IGST, TaxRate; string customerName, customerLastName; customerName = invoice.customer_firstname; customerLastName = invoice.customer_lastname; if (customerName == null) { customerName = billingAddress.firstname; customerLastName = billingAddress.lastname; } ReadFromExcelFile(sku); TaxRate = masterItem.IGST + "%"; IGST = masterItem.IGST; CGST = masterItem.CGST; SGST = masterItem.SGST; StringBuilder stringBuilder = new StringBuilder(); List <string> streets = new List <string>(billingAddress.street); foreach (var street in streets) { stringBuilder.Append(street); } BASE_AMOUNT = item.base_row_total_incl_tax; //discount amount per line BaseDiscountAmount = item.base_discount_amount; //get the base amount before tax if (BaseDiscountAmount > 0) { LineAmount = BASE_AMOUNT - BaseDiscountAmount; //line amount before tax RateBasic = LineAmount * 100 / (100 + Double.Parse(masterItem.IGST)); } else { LineAmount = BASE_AMOUNT; //line amount before tax RateBasic = BASE_AMOUNT * 100 / (100 + Double.Parse(masterItem.IGST)); } DeliveryCharge = invoice.shipping_amount; //check billing state if (billingAddress.region.Equals(STATE)) { //calculate taxe on base rate + delivery charge CGST = (RateBasic + DeliveryCharge) * CGST / 100; SGST = (RateBasic + DeliveryCharge) * SGST / 100; IGST = "0"; //invoice amount InvoiceAmount = RateBasic + DeliveryCharge + CGST + SGST; } else { CGST = 0; SGST = 0; //calculate taxe on base rate + delivery charge IGST = ((RateBasic + DeliveryCharge) * Double.Parse(masterItem.IGST) / 100).ToString("#.##"); //invoice amount InvoiceAmount = RateBasic + DeliveryCharge + Double.Parse(IGST); } //add row to data table dt.Rows.Add(invoice.increment_id, invoice.created_at, "POS Invoice", "Main Location", customerName + " " + customerLastName, stringBuilder.ToString(), "", "", "", billingAddress.country_id, billingAddress.region, "", "", "POS Sales", item.name, "", TaxRate, "", "", item.qty_ordered, "NO", item.base_price_incl_tax, RateBasic.ToString("#.##"), item.discount_percent, LineAmount, invoice.shipping_amount, CGST.ToString("#.##"), SGST.ToString("#.##"), IGST, "", InvoiceAmount.ToString("#.##"), "", "", "", sku); // set data grid view data source grid.DataSource = dt; grid.Columns["SKU"].Visible = false; grid.AllowUserToAddRows = false; } catch (Exception er) { MessageBox.Show(er.Message, "Error"); } }
internal void textChanged(object changedString) { switch (changedString as string) { case "HSNCode": { if (!string.IsNullOrEmpty(HSNCode) && SelectedRecord == null) { HSNList = null; var filtered = usersFromDB.AsEnumerable().Where(r => r.Field <string>("HSNCode").ToLower().Contains(HSNCode.ToLower())); HSNList = filtered.Count() > 0 ? filtered.CopyToDataTable() : usersFromDB.Copy(); } } break; case "GoodsDesc": { if (!string.IsNullOrEmpty(GoodsDesc) && SelectedRecord == null) { HSNList = null; var filtered = usersFromDB.AsEnumerable().Where(r => r.Field <string>("goods_Description").ToLower().Contains(GoodsDesc.ToLower())); HSNList = filtered.Count() > 0 ? filtered.CopyToDataTable() : usersFromDB.Copy(); } } break; case "CGST": { if (!string.IsNullOrEmpty(CGST) && SelectedRecord == null) { HSNList = null; var filtered = usersFromDB.AsEnumerable().Where(r => r.Field <string>("CGST").ToLower().Contains(CGST.ToLower())); HSNList = filtered.Count() > 0 ? filtered.CopyToDataTable() : usersFromDB.Copy(); } } break; case "SGST": { if (!string.IsNullOrEmpty(SGST) && SelectedRecord == null) { HSNList = null; var filtered = usersFromDB.AsEnumerable().Where(r => r.Field <string>("SGST").ToLower().Contains(SGST.ToLower())); HSNList = filtered.Count() > 0 ? filtered.CopyToDataTable() : usersFromDB.Copy(); } } break; case "IGST": { if (!string.IsNullOrEmpty(IGST) && SelectedRecord == null) { HSNList = null; var filtered = usersFromDB.AsEnumerable().Where(r => r.Field <string>("IGST").ToLower().Contains(IGST.ToLower())); HSNList = filtered.Count() > 0 ? filtered.CopyToDataTable() : usersFromDB.Copy(); } } break; case "CompCess": { if (!string.IsNullOrEmpty(CompCess) && SelectedRecord == null) { HSNList = null; var filtered = usersFromDB.AsEnumerable().Where(r => r.Field <string>("CompensationCess").ToLower().Contains(CompCess.ToLower())); HSNList = filtered.Count() > 0 ? filtered.CopyToDataTable() : usersFromDB.Copy(); } } break; case "IsValidHSN": { if (!string.IsNullOrEmpty(IsValidHSN) && SelectedRecord == null) { HSNList = null; var filtered = usersFromDB.AsEnumerable().Where(r => r.Field <string>("isValid").ToLower().Contains(IsValidHSN.ToLower())); HSNList = filtered.Count() > 0 ? filtered.CopyToDataTable() : usersFromDB.Copy(); } } break; } }