public static int addSalesRetrunDetails(SalesReturnDetails sale, PusrchaseSaleAccount purchase) { try { int i = salesReturnDetailsProvider.addSalesRetrunDetails(sale, purchase); return(i); } catch (Exception ex) { throw ex; } }
public static int addPurchaseDetails(PurchaseDetails Purchase, PusrchaseSaleAccount purchSale) { try { int i = purchaseDetailsProvider.addPurchaseDetails(Purchase, purchSale); return(i); } catch (Exception ex) { throw ex; } }
public static int addSalesDetailsForConvertChalan(SalesDetails sale, PusrchaseSaleAccount purchase) { try { int i = salesDetailsProvider.addSalesDetailsForConvertChalan(sale, purchase); return(i); } catch (Exception ex) { throw ex; } }
public static int addDebitNote(SalesReturnDetails DebitNote, PusrchaseSaleAccount purchase) { try { int result = 0; result = DebitNoteProvider.addDebitNote(DebitNote, purchase); return(result); } catch (Exception ae) { throw ae; } }
public static int addSalescreditNote(SalesReturnDetails creditNote, PusrchaseSaleAccount sale) { using (var Conn = new SqlConnection(_connectionString)) { SqlHandler sqlH = new SqlHandler(); SqlTransaction trans = null; try { Conn.Open(); trans = Conn.BeginTransaction(); List <KeyValuePair <string, object> > parameter = new List <KeyValuePair <string, object> >(); parameter.Add(new KeyValuePair <string, object>("@creditNoteId", creditNote.salesReturnId)); parameter.Add(new KeyValuePair <string, object>("@creditNoteInvoiceId", creditNote.salesReturnInvoiceId)); parameter.Add(new KeyValuePair <string, object>("@financialYearID", creditNote.financialYearID)); parameter.Add(new KeyValuePair <string, object>("@creditNoteDate", creditNote.salesReturnDate)); parameter.Add(new KeyValuePair <string, object>("@state", creditNote.state)); parameter.Add(new KeyValuePair <string, object>("@stateCode", creditNote.stateCode)); parameter.Add(new KeyValuePair <string, object>("@customerId", creditNote.customerId)); parameter.Add(new KeyValuePair <string, object>("@creditNoteType", creditNote.salesType)); parameter.Add(new KeyValuePair <string, object>("@creditNoteAmount", creditNote.totalbillAmount)); parameter.Add(new KeyValuePair <string, object>("@naration", creditNote.naration)); parameter.Add(new KeyValuePair <string, object>("@paymentType", creditNote.paymentType)); parameter.Add(new KeyValuePair <string, object>("@bankName", creditNote.bankName)); parameter.Add(new KeyValuePair <string, object>("@bankId", creditNote.bankId)); parameter.Add(new KeyValuePair <string, object>("@chequeDate", creditNote.chequeDate)); parameter.Add(new KeyValuePair <string, object>("@refNo", creditNote.chequeNo_refNo)); parameter.Add(new KeyValuePair <string, object>("@isCustomerRetailer", creditNote.isCustomerRetailer)); parameter.Add(new KeyValuePair <string, object>("@isDelete", creditNote.isDelete)); // parameter.Add(new KeyValuePair<string, object>("@AddSaleItem", creditNote.SaleItemTable)); int i = sqlH.ExecuteNonQueryTM("[dbo].[Usp_addCreditNoteMaster]", parameter, Conn, trans); if (creditNote.isDelete == false) { List <KeyValuePair <string, object> > parameter2 = new List <KeyValuePair <string, object> >(); parameter2.Add(new KeyValuePair <string, object>("@transactionId", sale.transactionId)); parameter2.Add(new KeyValuePair <string, object>("@financialYearID", creditNote.financialYearID)); parameter2.Add(new KeyValuePair <string, object>("@transactionDate", creditNote.salesReturnDate)); parameter2.Add(new KeyValuePair <string, object>("@billId", sale.billId)); parameter2.Add(new KeyValuePair <string, object>("@Hamali", sale.Hamali)); parameter2.Add(new KeyValuePair <string, object>("@RoundOff", sale.RoundOff)); parameter2.Add(new KeyValuePair <string, object>("@discount", sale.discount)); parameter2.Add(new KeyValuePair <string, object>("@Igst5", sale.Igst5)); parameter2.Add(new KeyValuePair <string, object>("@Igst12", sale.Igst12)); parameter2.Add(new KeyValuePair <string, object>("@Igst18", sale.Igst18)); parameter2.Add(new KeyValuePair <string, object>("@Igst28", sale.Igst28)); parameter2.Add(new KeyValuePair <string, object>("@salePurchaseAccount", sale.salePurchaseAccount)); parameter2.Add(new KeyValuePair <string, object>("@issalePurchase", sale.issalePurchase)); parameter2.Add(new KeyValuePair <string, object>("@stateCode", sale.stateCode)); int s = sqlH.ExecuteNonQueryTM("[dbo].[Usp_addAllCreditNoteAccount]", parameter2, Conn, trans); } int result = 0; for (int k = 0; k < creditNote.SaleRetrunItemTable.Rows.Count; k++) { List <KeyValuePair <string, object> > parameter1 = new List <KeyValuePair <string, object> >(); parameter1.Add(new KeyValuePair <string, object>("@creditNoteId", creditNote.salesReturnId)); parameter1.Add(new KeyValuePair <string, object>("@creditNoteInvoiceId", creditNote.salesReturnInvoiceId)); parameter1.Add(new KeyValuePair <string, object>("@financialYearID", creditNote.financialYearID)); parameter1.Add(new KeyValuePair <string, object>("@creditNoteDetailsId", creditNote.SaleRetrunItemTable.Rows[k]["salesReturnItemDetailsId"])); //4 parameter1.Add(new KeyValuePair <string, object>("@itemName", creditNote.SaleRetrunItemTable.Rows[k]["itemName"])); //8 parameter1.Add(new KeyValuePair <string, object>("@quantity", creditNote.SaleRetrunItemTable.Rows[k]["Quantity"])); //8 parameter1.Add(new KeyValuePair <string, object>("@batchNo", creditNote.SaleRetrunItemTable.Rows[k]["batchNo"])); //12 parameter1.Add(new KeyValuePair <string, object>("@unitBy", creditNote.SaleRetrunItemTable.Rows[k]["unitBy"])); //13 parameter1.Add(new KeyValuePair <string, object>("@rate", creditNote.SaleRetrunItemTable.Rows[k]["Rate"])); //5 parameter1.Add(new KeyValuePair <string, object>("@IGST", creditNote.SaleRetrunItemTable.Rows[k]["IGST"])); //16 parameter1.Add(new KeyValuePair <string, object>("@CGST", creditNote.SaleRetrunItemTable.Rows[k]["CGST"])); //16 parameter1.Add(new KeyValuePair <string, object>("@SGST", creditNote.SaleRetrunItemTable.Rows[k]["SGST"])); //16 parameter1.Add(new KeyValuePair <string, object>("@totalAmount", creditNote.SaleRetrunItemTable.Rows[k]["totalAmount"])); //16 parameter1.Add(new KeyValuePair <string, object>("@totalAmtWithGST", creditNote.SaleRetrunItemTable.Rows[k]["totalAmtWithGST"])); //16 parameter1.Add(new KeyValuePair <string, object>("@isDelete", creditNote.isDelete)); //19 result = sqlH.ExecuteNonQueryTM("Usp_addCreditNoteDetails", parameter1, Conn, trans); } trans.Commit(); return(i); } catch (Exception ex) { if (trans != null) { trans.Rollback(); } throw ex; } finally { Conn.Close(); } } }
public static int addPurchaseReturnDetails(PurchaseReutrnDetails Purchase, PusrchaseSaleAccount purch) { using (var Conn = new SqlConnection(_connectionString)) { SqlHandler sqlH = new SqlHandler(); SqlTransaction trans = null; try { Conn.Open(); trans = Conn.BeginTransaction(); List <KeyValuePair <string, object> > parameter = new List <KeyValuePair <string, object> >(); parameter.Add(new KeyValuePair <string, object>("@purchaseReutrnInvoiceId", Purchase.purchaseReutrnInvoiceId)); parameter.Add(new KeyValuePair <string, object>("@purchaseReutrnId", Purchase.purchaseReutrnId)); parameter.Add(new KeyValuePair <string, object>("@dealerId", Purchase.dealerId)); parameter.Add(new KeyValuePair <string, object>("@challanDate", Purchase.challanDate)); parameter.Add(new KeyValuePair <string, object>("@remark", Purchase.remark)); parameter.Add(new KeyValuePair <string, object>("@netBillAmount", Purchase.netBillAmount)); parameter.Add(new KeyValuePair <string, object>("@paidAmount", Purchase.paidAmount)); parameter.Add(new KeyValuePair <string, object>("@paymentType", Purchase.paymentType)); parameter.Add(new KeyValuePair <string, object>("@bankName", Purchase.bankName)); parameter.Add(new KeyValuePair <string, object>("@bankId", Purchase.bankId)); parameter.Add(new KeyValuePair <string, object>("@chequeDate", Purchase.chequeDate)); parameter.Add(new KeyValuePair <string, object>("@refNo", Purchase.chequeNo_refNo)); parameter.Add(new KeyValuePair <string, object>("@addedBy", 1)); parameter.Add(new KeyValuePair <string, object>("@addedOn", DateTime.UtcNow)); parameter.Add(new KeyValuePair <string, object>("@state", Purchase.state)); parameter.Add(new KeyValuePair <string, object>("@stateCode", Purchase.stateCode)); parameter.Add(new KeyValuePair <string, object>("@isDelete", Purchase.isDelete)); parameter.Add(new KeyValuePair <string, object>("@FinancialYearID", Purchase.FinancialYearID)); parameter.Add(new KeyValuePair <string, object>("@purchaseInvoiceNo", Purchase.purchaseInvoiceNo)); parameter.Add(new KeyValuePair <string, object>("@purchaseDate", Purchase.purchaseDate)); int i = sqlH.ExecuteNonQueryTM("[dbo].[Usp_addPurchaseReturnDetails]", parameter, Conn, trans); int result = 0; if (Purchase.isDelete == false) { ///Save Gst Account Group Payment Due Table List <KeyValuePair <string, object> > parameterGroup = new List <KeyValuePair <string, object> >(); parameterGroup.Add(new KeyValuePair <string, object>("@transactionId", purch.transactionId)); parameterGroup.Add(new KeyValuePair <string, object>("@billId", purch.billId)); parameterGroup.Add(new KeyValuePair <string, object>("@RoundOff", purch.RoundOff)); parameterGroup.Add(new KeyValuePair <string, object>("@discount", purch.discount)); parameterGroup.Add(new KeyValuePair <string, object>("@Hamali", purch.Hamali)); parameterGroup.Add(new KeyValuePair <string, object>("@Igst5", purch.Igst5)); parameterGroup.Add(new KeyValuePair <string, object>("@Igst12", purch.Igst12)); parameterGroup.Add(new KeyValuePair <string, object>("@Igst18", purch.Igst18)); parameterGroup.Add(new KeyValuePair <string, object>("@Igst28", purch.Igst28)); parameterGroup.Add(new KeyValuePair <string, object>("@salePurchaseAccount", purch.salePurchaseAccount)); parameterGroup.Add(new KeyValuePair <string, object>("@issalePurchase", purch.issalePurchase)); parameterGroup.Add(new KeyValuePair <string, object>("@stateCode", purch.stateCode)); parameterGroup.Add(new KeyValuePair <string, object>("@transactionDate", Purchase.challanDate)); parameterGroup.Add(new KeyValuePair <string, object>("@FinancialYearID", Purchase.FinancialYearID)); result = sqlH.ExecuteNonQueryI("[dbo].[Usp_addAllPurchasesReturnAccount]", parameterGroup); ///End /// } for (int k = 0; k < Purchase.PurchaseRetrunItemTable.Rows.Count; k++) { List <KeyValuePair <string, object> > parameter1 = new List <KeyValuePair <string, object> >(); parameter1.Add(new KeyValuePair <string, object>("@purchaseReutrnInvoiceId", Purchase.purchaseReutrnInvoiceId)); parameter1.Add(new KeyValuePair <string, object>("@itemId", Purchase.PurchaseRetrunItemTable.Rows[k]["itemId"])); parameter1.Add(new KeyValuePair <string, object>("@purchaseReutrnItemDetailId", Purchase.PurchaseRetrunItemTable.Rows[k]["purchaseReutrnItemDetailId"])); parameter1.Add(new KeyValuePair <string, object>("@stockId", Purchase.PurchaseRetrunItemTable.Rows[k]["stockId"])); parameter1.Add(new KeyValuePair <string, object>("@companyId", Purchase.PurchaseRetrunItemTable.Rows[k]["companyId"])); parameter1.Add(new KeyValuePair <string, object>("@categoryId", Purchase.PurchaseRetrunItemTable.Rows[k]["categoryId"])); parameter1.Add(new KeyValuePair <string, object>("@Quantity", Purchase.PurchaseRetrunItemTable.Rows[k]["Quantity"])); parameter1.Add(new KeyValuePair <string, object>("@FreeQuantity", Purchase.PurchaseRetrunItemTable.Rows[k]["freeQuantity"])); parameter1.Add(new KeyValuePair <string, object>("@IGST", Purchase.PurchaseRetrunItemTable.Rows[k]["IGST"])); parameter1.Add(new KeyValuePair <string, object>("@CGST", Purchase.PurchaseRetrunItemTable.Rows[k]["CGST"])); parameter1.Add(new KeyValuePair <string, object>("@SGST", Purchase.PurchaseRetrunItemTable.Rows[k]["SGST"])); parameter1.Add(new KeyValuePair <string, object>("@batchNo", Purchase.PurchaseRetrunItemTable.Rows[k]["batchNo"])); parameter1.Add(new KeyValuePair <string, object>("@unitBy", Purchase.PurchaseRetrunItemTable.Rows[k]["unitBy"])); parameter1.Add(new KeyValuePair <string, object>("@discount", Purchase.PurchaseRetrunItemTable.Rows[k]["discount"])); parameter1.Add(new KeyValuePair <string, object>("@purchaseRate", Purchase.PurchaseRetrunItemTable.Rows[k]["purchaseRate"])); parameter1.Add(new KeyValuePair <string, object>("@salesCashRate", Purchase.PurchaseRetrunItemTable.Rows[k]["salesCashRate"])); parameter1.Add(new KeyValuePair <string, object>("@salesCreditRate", 0)); parameter1.Add(new KeyValuePair <string, object>("@wholeSalesCashRate", 0)); parameter1.Add(new KeyValuePair <string, object>("@wholeSalesCreditRate", 0)); parameter1.Add(new KeyValuePair <string, object>("@addedBy", 1)); parameter1.Add(new KeyValuePair <string, object>("@addedOn", Purchase.challanDate)); parameter1.Add(new KeyValuePair <string, object>("@isDelete", Purchase.isDelete)); parameter1.Add(new KeyValuePair <string, object>("@purchaseReutrnId", Purchase.purchaseReutrnId)); parameter1.Add(new KeyValuePair <string, object>("@FinancialYearID", Purchase.FinancialYearID)); //parameter1.Add(new KeyValuePair<string, object>("@state", Purchase.PurchaseRetrunItemTable.Rows[k]["state"])); //parameter1.Add(new KeyValuePair<string, object>("@stateCode", Purchase.PurchaseRetrunItemTable.Rows[k]["stateCode"])); result = sqlH.ExecuteNonQueryTM("[dbo].[Usp_addPurchaseReturnStockUpdate]", parameter1, Conn, trans); } trans.Commit(); return(i); } catch (Exception ex) { if (trans != null) { trans.Rollback(); } throw ex; } finally { Conn.Close(); } } }
private void btnSave_Click(object sender, EventArgs e) { try { if (cmbDealerName.SelectedIndex < 0) { if (Utility.Langn == "English") { MessageBox.Show("Please Add /Select customer name"); } else { MessageBox.Show("कृपया ग्राहकाचे नाव भरा किवा निवडा.."); } cmbDealerName.Focus(); return; } for (int i = 0; i < dgvSaleItems.Rows.Count; i++) { if (dgvSaleItems.Rows[i].Cells[1].Value == null) { if (Utility.Langn == "English") { MessageBox.Show("Please Add Item Name in list"); } else { MessageBox.Show("कृपया लिस्ट मध्ये वस्तूचे नाव भरा.."); } dgvSaleItems.Focus(); dgvSaleItems.CurrentCell = dgvSaleItems.Rows[i].Cells[1]; return; } if (dgvSaleItems.Rows[i].Cells[2].Value == null) { if (Utility.Langn == "English") { MessageBox.Show("Please Add Batch No in list"); } else { MessageBox.Show("कृपया लिस्ट मध्ये बॅच नंबर भरा"); } dgvSaleItems.Focus(); dgvSaleItems.CurrentCell = dgvSaleItems.Rows[i].Cells[2]; return; } if (dgvSaleItems.Rows[i].Cells[3].Value == null) { if (Utility.Langn == "English") { MessageBox.Show("Please Add Quantity in list"); } else { MessageBox.Show("कृपया लिस्ट मध्ये नग भरा"); } dgvSaleItems.Focus(); dgvSaleItems.CurrentCell = dgvSaleItems.Rows[i].Cells[3]; return; } if (dgvSaleItems.Rows[i].Cells[4].Value == null) { if (Utility.Langn == "English") { MessageBox.Show("Please Add Paking in list"); } else { MessageBox.Show("कृपया लिस्ट मध्ये पॅकींग भरा"); } dgvSaleItems.Focus(); dgvSaleItems.CurrentCell = dgvSaleItems.Rows[i].Cells[3]; return; } if (dgvSaleItems.Rows[i].Cells[5].Value == null) { if (Utility.Langn == "English") { MessageBox.Show("Please Add rate in list"); } else { MessageBox.Show("कृपया लिस्ट मध्ये दर भरा"); } dgvSaleItems.Focus(); dgvSaleItems.CurrentCell = dgvSaleItems.Rows[i].Cells[3]; return; } if (dgvSaleItems.Rows[i].Cells[6].Value == null) { if (Utility.Langn == "English") { MessageBox.Show("Please add IGST(%) in list"); } else { MessageBox.Show("कृपया लिस्ट मध्ये IGST(%) भरा"); } dgvSaleItems.Focus(); dgvSaleItems.CurrentCell = dgvSaleItems.Rows[i].Cells[6]; return; } if (dgvSaleItems.Rows[i].Cells[7].Value == null) { if (Utility.Langn == "English") { MessageBox.Show("Please add CGST(%) in list"); } else { MessageBox.Show("कृपया लिस्ट मध्ये CGST(%) भरा"); } dgvSaleItems.Focus(); dgvSaleItems.CurrentCell = dgvSaleItems.Rows[i].Cells[7]; return; } if (dgvSaleItems.Rows[i].Cells[6].Value == null || Convert.ToDouble(dgvSaleItems.Rows[i].Cells[6].Value) == 0) { if (Utility.Langn == "English") { MessageBox.Show("Please Add Total Amount"); } else { MessageBox.Show("कृपया लिस्ट मध्ये एकूण रक्कम भरा."); } dgvSaleItems.Focus(); dgvSaleItems.CurrentCell = dgvSaleItems.Rows[i].Cells[6]; return; } } if (cmbPaymentType.Text.Equals("Cheque")) { if (cmbBank.Text.Equals("") || cmbBank.Text.Equals("0")) { if (Utility.Langn == "English") { MessageBox.Show("Please Add bank Name...!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { MessageBox.Show("कृपया बँकचे नाव भरा...!", "त्रुटी", MessageBoxButtons.OK, MessageBoxIcon.Error); } cmbBank.Focus(); return; } else if (txtchqDDNo.Text.Equals("") || txtchqDDNo.Text.Equals("0")) { if (Utility.Langn == "English") { MessageBox.Show("Please Add Cheque/DD Number...!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { MessageBox.Show("कृपया चेक / डीडी/रेफ नंबर भरा...!", "त्रुटी", MessageBoxButtons.OK, MessageBoxIcon.Error); } txtchqDDNo.Focus(); return; } } if (cmbPaymentType.Text.Equals("Card Payment")) { if (cmbBank.Text.Equals("") || cmbBank.Text.Equals("0")) { if (Utility.Langn == "English") { MessageBox.Show("Please Add bank Name...!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { MessageBox.Show("कृपया बँकचे नाव भरा...!", "त्रुटी", MessageBoxButtons.OK, MessageBoxIcon.Error); } cmbBank.Focus(); return; } else if (txtchqDDNo.Text.Equals("") || txtchqDDNo.Text.Equals("0")) { if (Utility.Langn == "English") { MessageBox.Show("Please Add Cheque/DD Number...!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { MessageBox.Show("कृपया चेक / डीडी/रेफ नंबर भरा...!", "त्रुटी", MessageBoxButtons.OK, MessageBoxIcon.Error); } txtchqDDNo.Focus(); return; } } if (cmbPaymentType.Text.Equals("") || cmbPaymentType.Text.Equals("0")) { if (Utility.Langn == "English") { MessageBox.Show("कृपया Payment प्रकार निवडा ..!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { MessageBox.Show("कृपया Payment प्रकार निवडा ..!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } cmbPaymentType.Focus(); return; } /// long customerId = 0; SalesReturnDetails purch = new SalesReturnDetails(); purch.customerId = Convert.ToInt64(cmbDealerName.SelectedValue); DataTable dtSaleItems = new DataTable(); foreach (DataGridViewColumn col in dgvSaleItems.Columns) { dtSaleItems.Columns.Add(col.Name); } foreach (DataGridViewRow row in dgvSaleItems.Rows) { DataRow dRow = dtSaleItems.NewRow(); foreach (DataGridViewCell cell in row.Cells) { if (cell.Value == null) { if (Utility.Langn == "English") { MessageBox.Show("Please Fill All details in List"); } else { MessageBox.Show("कृपया लिस्ट मध्ये पूर्ण माहिती भरा"); } return; } dRow[cell.ColumnIndex] = cell.Value; } dtSaleItems.Rows.Add(dRow); } purch.SaleRetrunItemTable = dtSaleItems; purch.salesReturnDate = Convert.ToDateTime(dtpChallenDate.Value.ToShortDateString()); if (isDelete == false) { purch.salesReturnInvoiceId = debitNoteController.getMaxIdDebitNoteId(Utility.FinancilaYearId).ToString(); } else { purch.salesReturnInvoiceId = txtInvoiceNo.Text; } purch.financialYearID = Utility.FinancilaYearId; // txtInvoiceNo.Text = salesReturnDetailsController.getMaxIdSaleRetrunInvoiceId().ToString(); if (rbCash.Checked == true) { purch.salesType = "Cash"; } if (rbCredit.Checked == true) { purch.salesType = "Credit"; } purch.paymentType = cmbPaymentType.Text; purch.totalbillAmount = Utility.ParseValue(txtNetAmount.Text); purch.chequeDate = dtpchedate.Value; purch.bankName = cmbBank.Text; purch.state = cmbIGST.Text; purch.stateCode = txtStateCode.Text; purch.naration = txtRemark.Text.Trim(); purch.isDelete = isDelete; if (cmbBank.SelectedIndex > 0) { purch.bankId = Convert.ToInt32(cmbBank.SelectedValue); } else { purch.bankId = 0; } purch.chequeNo_refNo = txtchqDDNo.Text; purch.addedBy = Utility.LoginID; PusrchaseSaleAccount purchase = new PusrchaseSaleAccount(); purchase.RoundOff = Convert.ToDouble(0); purchase.Hamali = Convert.ToDouble(0); purchase.discount = Convert.ToDouble(0); purchase.billId = Convert.ToInt64(purch.salesReturnInvoiceId); purchase.stateCode = txtStateCode.Text; purchase.issalePurchase = "CreditNote"; purchase.Igst5 = IGST5; purchase.Igst12 = IGST12; purchase.Igst18 = IGST18; purchase.Igst28 = IGST28; purchase.salePurchaseAccount = Math.Round(Convert.ToDouble(txtNetAmount.Text) - (IGST5 + IGST12 + IGST18 + IGST28), 2); int ks = debitNoteController.addDebitNote(purch, purchase); if (ks > 0) { if (purch.isDelete == false) { if (Utility.Langn == "English") { MessageBox.Show("Record Saved Successfully", "Save", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("माहिती यशस्वीरित्या भरली गेली", "Save", MessageBoxButtons.OK, MessageBoxIcon.Information); } } else { if (Utility.Langn == "English") { MessageBox.Show("Record Deleted Successfully", "Save", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("माहिती यशस्वीरित्या डिलीट केली गेली", "Save", MessageBoxButtons.OK, MessageBoxIcon.Information); } } // bill(); btnnew_Click(sender, e); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
//public static DataTable getEmptySaleItem() //{ // try // { // SqlHandler sqlH = new SqlHandler(); // DataTable i = sqlH.ExecuteAsDataTable("[dbo].[Usp_getEmptySaleItem]"); // return i; // } // catch (Exception ae) // { // throw ae; // } //} public static int addSalesRetrunDetails(SalesReturnDetails sale, PusrchaseSaleAccount salePurch) { using (var Conn = new SqlConnection(_connectionString)) { SqlHandler sqlH = new SqlHandler(); SqlTransaction trans = null; try { Conn.Open(); trans = Conn.BeginTransaction(); List <KeyValuePair <string, object> > parameter = new List <KeyValuePair <string, object> >(); parameter.Add(new KeyValuePair <string, object>("@salesReturnId", sale.salesReturnId)); parameter.Add(new KeyValuePair <string, object>("@salesReturnInvoiceId", sale.salesReturnInvoiceId)); parameter.Add(new KeyValuePair <string, object>("@financialYearID", sale.financialYearID)); parameter.Add(new KeyValuePair <string, object>("@salesReturnDate", sale.salesReturnDate)); parameter.Add(new KeyValuePair <string, object>("@customerId", sale.customerId)); parameter.Add(new KeyValuePair <string, object>("@salesType", sale.salesType)); parameter.Add(new KeyValuePair <string, object>("@totalbillAmount", sale.totalbillAmount)); parameter.Add(new KeyValuePair <string, object>("@paidAmount", sale.paidAmount)); parameter.Add(new KeyValuePair <string, object>("@paymentType", sale.paymentType)); parameter.Add(new KeyValuePair <string, object>("@bankName", sale.bankName)); parameter.Add(new KeyValuePair <string, object>("@bankId", sale.bankId)); parameter.Add(new KeyValuePair <string, object>("@chequeDate", sale.chequeDate)); parameter.Add(new KeyValuePair <string, object>("@refNo", sale.chequeNo_refNo)); parameter.Add(new KeyValuePair <string, object>("@addedBy", sale.addedBy)); parameter.Add(new KeyValuePair <string, object>("@addedOn", sale.addedOn)); parameter.Add(new KeyValuePair <string, object>("@state", sale.state)); parameter.Add(new KeyValuePair <string, object>("@stateCode", sale.stateCode)); parameter.Add(new KeyValuePair <string, object>("@isCustomerRetailer", sale.isCustomerRetailer)); parameter.Add(new KeyValuePair <string, object>("@isDelete", sale.isDelete)); parameter.Add(new KeyValuePair <string, object>("@saleInvoiceNo", sale.saleInvoiceNo)); parameter.Add(new KeyValuePair <string, object>("@saleDate", sale.saleDate)); // parameter.Add(new KeyValuePair<string, object>("@AddSaleItem", sale.SaleItemTable)); int i = sqlH.ExecuteNonQueryTM("[dbo].[Usp_addSalesReturnDetails]", parameter, Conn, trans); if (sale.isDelete == false) { List <KeyValuePair <string, object> > parameter2 = new List <KeyValuePair <string, object> >(); parameter2.Add(new KeyValuePair <string, object>("@transactionId", salePurch.transactionId)); parameter2.Add(new KeyValuePair <string, object>("@financialYearID", sale.financialYearID)); parameter2.Add(new KeyValuePair <string, object>("@transactionDate", sale.salesReturnDate)); parameter2.Add(new KeyValuePair <string, object>("@billId", salePurch.billId)); parameter2.Add(new KeyValuePair <string, object>("@Hamali", salePurch.Hamali)); parameter2.Add(new KeyValuePair <string, object>("@RoundOff", salePurch.RoundOff)); parameter2.Add(new KeyValuePair <string, object>("@discount", salePurch.discount)); parameter2.Add(new KeyValuePair <string, object>("@Igst5", salePurch.Igst5)); parameter2.Add(new KeyValuePair <string, object>("@Igst12", salePurch.Igst12)); parameter2.Add(new KeyValuePair <string, object>("@Igst18", salePurch.Igst18)); parameter2.Add(new KeyValuePair <string, object>("@Igst28", salePurch.Igst28)); parameter2.Add(new KeyValuePair <string, object>("@salePurchaseAccount", salePurch.salePurchaseAccount)); parameter2.Add(new KeyValuePair <string, object>("@issalePurchase", salePurch.issalePurchase)); parameter2.Add(new KeyValuePair <string, object>("@stateCode", sale.stateCode)); int s = sqlH.ExecuteNonQueryTM("[dbo].[Usp_addAllSalesReturnAccount]", parameter2, Conn, trans); } int result = 0; for (int k = 0; k < sale.SaleRetrunItemTable.Rows.Count; k++) { List <KeyValuePair <string, object> > parameter1 = new List <KeyValuePair <string, object> >(); parameter1.Add(new KeyValuePair <string, object>("@salesReturnInvoiceId", sale.salesReturnInvoiceId)); //1 parameter1.Add(new KeyValuePair <string, object>("@financialYearID", sale.financialYearID)); //2 parameter1.Add(new KeyValuePair <string, object>("@itemId", sale.SaleRetrunItemTable.Rows[k]["itemId"])); //3 parameter1.Add(new KeyValuePair <string, object>("@salesReturnItemDetailsId", sale.SaleRetrunItemTable.Rows[k]["salesReturnItemDetailsId"])); //4 parameter1.Add(new KeyValuePair <string, object>("@stockId", sale.SaleRetrunItemTable.Rows[k]["stockId"])); //5 parameter1.Add(new KeyValuePair <string, object>("@companyId", sale.SaleRetrunItemTable.Rows[k]["companyId"])); //6 parameter1.Add(new KeyValuePair <string, object>("@categoryId", sale.SaleRetrunItemTable.Rows[k]["categoryId"])); //7 parameter1.Add(new KeyValuePair <string, object>("@Quantity", sale.SaleRetrunItemTable.Rows[k]["Quantity"])); //8 parameter1.Add(new KeyValuePair <string, object>("@IGST", sale.SaleRetrunItemTable.Rows[k]["IGST"])); //9 parameter1.Add(new KeyValuePair <string, object>("@CGST", sale.SaleRetrunItemTable.Rows[k]["CGST"])); //10 parameter1.Add(new KeyValuePair <string, object>("@SGST", sale.SaleRetrunItemTable.Rows[k]["SGST"])); //11 parameter1.Add(new KeyValuePair <string, object>("@batchNo", sale.SaleRetrunItemTable.Rows[k]["batchNo"])); //12 parameter1.Add(new KeyValuePair <string, object>("@unitBy", sale.SaleRetrunItemTable.Rows[k]["unitBy"])); //13 parameter1.Add(new KeyValuePair <string, object>("@discount", sale.SaleRetrunItemTable.Rows[k]["discount"])); //14 parameter1.Add(new KeyValuePair <string, object>("@perQtysalePrice", Math.Round(Convert.ToDouble(sale.SaleRetrunItemTable.Rows[k]["Rate"]) * 100 / (100 + Convert.ToDouble(sale.SaleRetrunItemTable.Rows[k]["IGST"])), 2))); //5 parameter1.Add(new KeyValuePair <string, object>("@salePrice", sale.SaleRetrunItemTable.Rows[k]["totalAmount"])); //16 parameter1.Add(new KeyValuePair <string, object>("@addedBy", sale.addedBy)); //17 parameter1.Add(new KeyValuePair <string, object>("@addedOn", sale.addedOn)); //18 parameter1.Add(new KeyValuePair <string, object>("@isDelete", sale.isDelete)); //19 result = sqlH.ExecuteNonQueryTM("Usp_addSaleReturnStockUpdate", parameter1, Conn, trans); } trans.Commit(); return(i); } catch (Exception ex) { if (trans != null) { trans.Rollback(); } throw ex; } finally { Conn.Close(); } } }