public void Pass_Inventry_Info(String InventryName) { try { using (SqlConnection con = new SqlConnection(ConnString)) { using (SqlCommand cmd = new SqlCommand("GetInventryIDForOrderByItemName", con)) { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@ItemName", InventryName); cmd.CommandTimeout = 0; con.Open(); SqlDataAdapter da = new SqlDataAdapter(cmd); DataTable dt = new DataTable(); da.Fill(dt); if (dt.Rows.Count > 0) { DataRow dr = (DataRow)dt.Rows[0]; InventryOrder io = new InventryOrder(); io.OrderItemID = Convert.ToInt32(dr["InvID"]); io.OrderItemName = InventryName; io.OrderItemBasePricePerPiece = float.Parse(dr["InvBasePricePerPiece"].ToString()); io.OrderItemBasePricePerKG = float.Parse(dr["InvBasePricePerKG"].ToString()); io.OrderIGST = float.Parse(dr["IGST"].ToString()); io.OrderCGST = float.Parse(dr["CGST"].ToString()); io.OrderSGST = float.Parse(dr["SGST"].ToString()); } } } } catch (Exception) { } }
private void dgv_CellDoubleClick_1(object sender, DataGridViewCellEventArgs e) { int rowIndex = e.RowIndex; DataGridViewRow row = dgv.Rows[rowIndex]; int CID = Convert.ToInt32(row.Cells[0].Value); string C_Name = "" + row.Cells[1].Value; InventryOrder i = new InventryOrder(); i.OrderEmployeeID = CID; i.OrderEmployeeName = C_Name; AppConfiguration c = new AppConfiguration(); int n = SetOrderCustomerID(c.TerminalID, CID); if (n > 0) { this.Visible = false; this.Visible = false; this.Close(); this.Hide(); if (Application.OpenForms.OfType <frmPrintToken>().Any()) { frmPrintToken frm = new frmPrintToken(); frm.Visible = false; frm.Close(); frm.Hide(); } frmPrintToken frm1 = new frmPrintToken(); frm1.Show(); } else { MessageBox.Show("Failed to set employee!!", "Alert Message", MessageBoxButtons.OK, MessageBoxIcon.Error); txtCustomerName.Focus(); } }
private void frmNewOrder_Load(object sender, EventArgs e) { InventryOrder io = new InventryOrder(); lblItemName.Text = "ITEM NAME: " + io.OrderItemName; lblItemNo.Text = "Item#: " + io.OrderItemID; lblCostumer.Text = "CUSTOMER: " + io.OrderCustomerName; if (io.OrderItemBasePricePerKG > 0) { rdoKG.Enabled = true; rdoKG.Checked = true; if (io.OrderItemBasePricePerPiece > 0) { rdoPIECE.Enabled = true; } else { rdoPIECE.Enabled = false; } } else if (io.OrderItemBasePricePerPiece > 0) { rdoPIECE.Enabled = true; rdoPIECE.Checked = true; if (io.OrderItemBasePricePerKG > 0) { rdoKG.Enabled = true; } else { rdoKG.Enabled = false; } } else { rdoPIECE.Enabled = false; rdoPIECE.Checked = false; rdoKG.Enabled = false; rdoKG.Checked = false; } if (rdoKG.Checked == true) { lblSelectedUnit.Text = "Selected Unit: KG"; } if (rdoPIECE.Checked == true) { lblSelectedUnit.Text = "Selected Unit: PIECE"; } }
private void Load_Order_header(int TerminalID) { try { using (SqlConnection con = new SqlConnection(ConnString)) { using (SqlCommand cmd = new SqlCommand("GetTerminalTotalOrder", con)) { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@TerminalID", TerminalID); cmd.CommandTimeout = 0; con.Open(); SqlDataAdapter da = new SqlDataAdapter(cmd); DataTable dt = new DataTable(); da.Fill(dt); if (dt.Rows.Count > 0) { DataRow dr = (DataRow)dt.Rows[0]; lblOrderDate.Text = "Order Date:" + dr["OrderDate"]; lblTokenNo.Text = "Token#: " + dr["OrderID"]; lblTime.Text = "Time: " + dr["Time"]; InventryOrder i = new InventryOrder(); i.OrderCustomerID = Convert.ToInt32(dr["CustomerID"]); i.OrderCustomerName = "" + dr["CustomerName"]; lblCustomer.Text = "Customer: " + i.OrderCustomerName; lblSalesMan.Text = "Salesman: " + dr["Salesman"]; lblTotalAmount.Text = "" + dr["TotalAmount"]; lblTax.Text = "" + dr["TaxAmount"]; lblNetINR.Text = "" + dr["NetAmount"]; } else { dgv.DataSource = null; } } } } catch (Exception) { dgv.DataSource = null; } }
private void dgv_CellClick(object sender, DataGridViewCellEventArgs e) { int rowIndex = e.RowIndex; DataGridViewRow row = dgv.Rows[rowIndex]; int CID = Convert.ToInt32(row.Cells[0].Value); string C_Name = "" + row.Cells[1].Value; InventryOrder i = new InventryOrder(); i.OrderCustomerID = CID; i.OrderCustomerName = C_Name; AppConfiguration c = new AppConfiguration(); int n = SetOrderCustomerID(c.TerminalID, CID); if (n > 0) { this.Visible = false; new frmOrder().Show(); } else { MessageBox.Show("Failed to set customer!!", "Alert Message", MessageBoxButtons.OK, MessageBoxIcon.Error); txtCustomerName.Focus(); } }
private void CalculateItemPriceWithTax() { InventryOrder i = new InventryOrder(); AppConfiguration a = new AppConfiguration(); int unit = GetSelectedUnit(); int IsOutsideUP = i.CustomerOutsideUP; float TotalTaxAmount = 0; float IGST = 0; float CGST = 0; float SGST = 0; float IGSTAmount = 0; float CGSTAmount = 0; float SGSTAmount = 0; float BaseAmount = 0; float InventryAmount = 0; if (unit == 1) { BaseAmount = i.OrderItemBasePricePerKG; } else if (unit == 0) { BaseAmount = i.OrderItemBasePricePerPiece; } if (txtQuantity.Text.Trim() != "" && txtQuantity.Text.Trim().Substring(0) != ".") { InventryAmount = (float.Parse(txtQuantity.Text.Trim()) * BaseAmount); } else { InventryAmount = 0; } if (IsOutsideUP == 1) { IGST = i.OrderIGST; CGST = 0; SGST = 0; IGSTAmount = (InventryAmount * IGST) / 100; CGSTAmount = 0; SGSTAmount = 0; } else { IGST = 0; CGST = i.OrderCGST; SGST = i.OrderSGST; IGSTAmount = 0; CGSTAmount = (InventryAmount * CGST) / 100; SGSTAmount = (InventryAmount * SGST) / 100; } TotalTaxAmount = IGSTAmount + CGSTAmount + SGSTAmount; lblCost.Text = "COST WITH TAX Rs. " + (Math.Round(InventryAmount, 2) + Math.Round(TotalTaxAmount, 2)); //if (rdoKG.Checked == true) //{ // lblCost.Text =""+ (float.Parse(txtQuantity.Text.Trim()) * io.OrderItemBasePricePerKG); // lblCost.Text = "COST Rs. " + Math.Round(float.Parse(lblCost.Text) + (float.Parse(lblCost.Text) * 18) / 100, 2); //} //else if (rdoPIECE.Checked == true) //{ // lblCost.Text = ""+(float.Parse(txtQuantity.Text.Trim()) * io.OrderItemBasePricePerPiece); // lblCost.Text = "COST Rs. " + Math.Round(float.Parse(lblCost.Text) + (float.Parse(lblCost.Text) * 18) / 100, 2); //} }
private void btnOK_Click(object sender, EventArgs e) { if (float.Parse(txtQuantity.Text) > 0) { InventryOrder i = new InventryOrder(); AppConfiguration a = new AppConfiguration(); int unit = GetSelectedUnit(); int IsOutsideUP = i.CustomerOutsideUP; float TotalTaxAmount = 0; float IGST = 0; float CGST = 0; float SGST = 0; float IGSTAmount = 0; float CGSTAmount = 0; float SGSTAmount = 0; float BaseAmount = 0; if (unit == 1) { BaseAmount = i.OrderItemBasePricePerKG; } else if (unit == 0) { BaseAmount = i.OrderItemBasePricePerPiece; } float InventryAmount = (float.Parse(txtQuantity.Text.Trim()) * BaseAmount); if (IsOutsideUP == 1) { IGST = i.OrderIGST; CGST = i.OrderCGST; SGST = i.OrderSGST; IGSTAmount = (InventryAmount * IGST) / 100; CGSTAmount = 0; SGSTAmount = 0; } else { IGST = i.OrderIGST; CGST = i.OrderCGST; SGST = i.OrderSGST; IGSTAmount = 0; CGSTAmount = (InventryAmount * CGST) / 100; SGSTAmount = (InventryAmount * SGST) / 100; } TotalTaxAmount = IGSTAmount + CGSTAmount + SGSTAmount; bool ExistFlag = CheckDataExists(i.OrderItemID, a.TerminalID); if (ExistFlag == true) { MessageBox.Show("This item is already exists in order!!", "Alert Message", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { int n = INSERT_NewOrder_Temp_DATA(0, i.OrderItemID, unit, BaseAmount, float.Parse(txtQuantity.Text.Trim()), InventryAmount, TotalTaxAmount, 0, a.CounterID, a.TerminalID, i.OrderCustomerID, GetMacAddress(), IGST, CGST, SGST, IGSTAmount, CGSTAmount, SGSTAmount, i.OrderCustomerName); if (n > 0) { // MessageBox.Show("New order has been successfully saved.", "Success Message", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Visible = false; this.Hide(); this.Close(); if (Application.OpenForms.OfType <frmOrder>().Any()) { frmOrder frm = new frmOrder(); frm.Hide(); frm.Close(); } frmOrder frm1 = new frmOrder(); frm1.Show(); } else { MessageBox.Show("Failed to saved new order", "Alert Message", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } btnPoint.Enabled = true; }