public void InsertOrganizationDetails(OrganizationModels organization) { SqlConnection conMyData; string strInsert; SqlCommand cmdInsert; conMyData = new SqlConnection(System.Configuration.ConfigurationSettings.AppSettings["Servosms"]); conMyData.Open(); strInsert = "Insert Into Organisation (CompanyID,DealerName,DealerShip,Address,City,State,Country ,PhoneNo ,FaxNo ,Email,Website,TinNo,Entrytax ,FoodLicNO,WM,Logo,Div_Office,Message,VAT_Rate,Acc_Date_from,Acc_Date_to,startinvoice) " + "Values (@CompanyID,@DealerName,@DealerShip,@Address,@City,@State,@Country ,@PhoneNo,@FaxNo ,@Email,@Website,@TinNo,@Entrytax,@FoodLicNO,@WM,@Logo,@Div_Office,@Message,@VAT_Rate,@Acc_date_from,@Acc_date_To,@StartInvoice)"; cmdInsert = new SqlCommand(strInsert, conMyData); cmdInsert.Parameters.Add("@StartInvoice", organization.InvoiceNo); cmdInsert.Parameters.Add("@CompanyID", organization.CompanyID); cmdInsert.Parameters.Add("@DealerName", organization.DealerName); cmdInsert.Parameters.Add("@DealerShip", organization.DealerShip); cmdInsert.Parameters.Add("@Address", organization.Address); cmdInsert.Parameters.Add("@City", organization.City); cmdInsert.Parameters.Add("@State", organization.State); cmdInsert.Parameters.Add("@Country", organization.Country); cmdInsert.Parameters.Add("@PhoneNo", organization.PhoneOff); cmdInsert.Parameters.Add("@FaxNo", organization.FaxNo); cmdInsert.Parameters.Add("@Email", organization.EMail); cmdInsert.Parameters.Add("@Website", organization.Website); cmdInsert.Parameters.Add("@TinNo", organization.Tinno); cmdInsert.Parameters.Add("@Entrytax", organization.Entrytax); cmdInsert.Parameters.Add("@FoodLicNO", organization.FoodLicNO); cmdInsert.Parameters.Add("@WM", organization.WMlic); cmdInsert.Parameters.Add("@Logo", organization.Logo); cmdInsert.Parameters.Add("@Div_Office", organization.DivOffice); cmdInsert.Parameters.Add("@Message", organization.Message); cmdInsert.Parameters.Add("@VAT_Rate", organization.VATRate); cmdInsert.Parameters.Add("@Acc_date_from", organization.DateFrom); cmdInsert.Parameters.Add("@Acc_date_to", organization.DateTo); cmdInsert.ExecuteNonQuery(); object op = null; dbobj.ExecProc(DbOperations_LATEST.OprType.Insert, "ProInsertLedger", ref op, "@Ledger_Name", "Cash", "@SubGrp_Name", "Cash in hand", "@Group_Name", "Current Assets", "@Grp_Nature", "Assets", "@Op_Bal", "0", "@Bal_Type", "Dr"); conMyData.Close(); }
public void InsertPayment(PaymentReceiptModel payment) { object op = null; if (payment.PanReceiptNo == true) { //************* Add This code by Mahesh on 05.07.008 ****************** int x = 0; dbobj1.Insert_or_Update("delete from AccountsLedgerTable where Particulars = 'Receipt (" + payment.ReceiptNo + ")'", ref x); dbobj1.Insert_or_Update("delete from AccountsLedgerTable where Particulars = 'Receipt_" + payment.Discount1 + " (" + payment.ReceiptNo + ")'", ref x); dbobj1.Insert_or_Update("delete from AccountsLedgerTable where Particulars = 'Receipt_" + payment.Discount2 + " (" + payment.ReceiptNo + ")'", ref x); dbobj1.Insert_or_Update("delete from CustomerLedgerTable where Particular = 'Payment Received(" + payment.ReceiptNo + ")' and CustID='" + payment.CustomerID + "'", ref x); dbobj1.Insert_or_Update("delete from Payment_Receipt where Receipt_No='" + payment.ReceiptNo + "'", ref x); //********************************************************************* //dbobj.ExecProc(OprType.Insert,"InsertPayment",ref op,"@Ledger_ID",Ledger_ID,"@amount",Amount,"@Acc_Type",Acc_Type,"@BankName",Acc_Type,"@ChNo",txtChequeno.Text,"@ChDate",txtDate.Text,"@Mode",DropMode.SelectedItem.Text,"@Narration",txtNar.Text,"@CustBankName",txtCustBankName.Text); if (payment.Mode == "Cash") { dbobj.ExecProc(DbOperations_LATEST.OprType.Insert, "InsertPayment", ref op, "@Ledger_ID", payment.Cust_ID, "@amount", payment.Amount, "@Acc_Type", payment.AccountType, "@BankName", "", "@ChNo", "", "@ChDate", "", "@Mode", payment.Mode, "@Narration", "", "@CustBankName", "", "@RecDate", payment.RecDate, "@Cust_ID", payment.Cust_ID, "@Receipt", "Save", "@Receipt_No", payment.ReceiptNo); } else { dbobj.ExecProc(DbOperations_LATEST.OprType.Insert, "InsertPayment", ref op, "@Ledger_ID", payment.Cust_ID, "@amount", payment.Amount, "@Acc_Type", payment.AccountType, "@BankName", payment.AccountType, "@ChNo", payment.ChequeNumber, "@ChDate", payment.ChequeDate, "@Mode", payment.Mode, "@Narration", payment.Narration, "@CustBankName", payment.CustBankName, "@RecDate", payment.RecDate, "@Cust_ID", payment.Cust_ID, "@Receipt", "Save", "@Receipt_No", payment.ReceiptNo); } } else { var date = Convert.ToDateTime(payment.RecDate); if (payment.Mode == "Cash") { dbobj.ExecProc(DbOperations_LATEST.OprType.Insert, "InsertPayment", ref op, "@Ledger_ID", payment.Cust_ID, "@amount", payment.Amount, "@Acc_Type", payment.AccountType, "@BankName", "", "@ChNo", "", "@ChDate", "", "@Mode", payment.Mode, "@Narration", "", "@CustBankName", "", "@RecDate", date, "@Cust_ID", payment.Cust_ID, "@Receipt", "Save", "@Receipt_No", payment.ReceiptNo); } else { dbobj.ExecProc(DbOperations_LATEST.OprType.Insert, "InsertPayment", ref op, "@Ledger_ID", payment.Cust_ID, "@amount", payment.Amount, "@Acc_Type", payment.AccountType, "@BankName", payment.AccountType, "@ChNo", payment.ChequeNumber, "@ChDate", payment.ChequeDate, "@Mode", payment.Mode, "@Narration", payment.Narration, "@CustBankName", payment.CustBankName, "@RecDate", payment.RecDate, "@Cust_ID", payment.Cust_ID, "@Receipt", "Save", "@Receipt_No", payment.ReceiptNo); } } }
public IHttpActionResult SavePayment(PaymentModels payment) { SqlDataReader SqlDtr; string Vouch_ID; string By_ID = ""; string sql = "Select Ledger_ID from Ledger_Master where Ledger_Name ='" + payment.By_Name + "'"; SqlDtr = obj.GetRecordSet(sql); if (SqlDtr.Read()) { By_ID = SqlDtr.GetValue(0).ToString(); } SqlDtr.Close(); sql = "Select top 1(voucher_ID + 1) from Payment_Transaction order by voucher_ID desc"; SqlDtr = obj.GetRecordSet(sql); if (SqlDtr.Read()) { Vouch_ID = SqlDtr.GetValue(0).ToString(); } else { Vouch_ID = "50001"; } SqlDtr.Close(); payment.c = 0; sql = "insert into payment_transaction values(" + Vouch_ID + ",'Payment'," + payment.Ledger_ID + "," + payment.Amount + "," + By_ID + "," + payment.Amount + ",'" + payment.Bank_name + "','" + payment.Cheque_No + "',CONVERT(datetime,'" + payment.dtDate + "', 103),'" + payment.narration + "','" + payment.uid + "', CONVERT(datetime,'" + payment.Entry_Date + "', 103))"; SqlDtr = obj.GetRecordSet(sql); payment.c = 1; object obj1 = null; dbobj.ExecProc(DbOperations_LATEST.OprType.Insert, "ProInsertAccountsLedger", ref obj1, "@Ledger_ID", payment.Ledger_ID, "@Particulars", "Payment (" + Vouch_ID + ")", "@Debit_Amount", payment.Amount, "@Credit_Amount", "0.0", "@type", "Dr", "@Invoice_Date", System.Convert.ToDateTime(payment.Entry_Date)); dbobj.ExecProc(DbOperations_LATEST.OprType.Insert, "ProInsertAccountsLedger", ref obj1, "@Ledger_ID", By_ID, "@Particulars", "Payment (" + Vouch_ID + ")", "@Debit_Amount", "0.0", "@Credit_Amount", payment.Amount, "@type", "Cr", "@Invoice_Date", System.Convert.ToDateTime(payment.Entry_Date)); dbobj.ExecProc(DbOperations_LATEST.OprType.Insert, "ProCustomerLedgerEntry", ref obj1, "@Voucher_ID", Vouch_ID, "@Ledger_ID", payment.Ledger_ID, "@Amount", payment.Amount, "@Type", "Dr.", "@Invoice_Date", System.Convert.ToDateTime(payment.Entry_Date)); dbobj.ExecProc(DbOperations_LATEST.OprType.Insert, "ProCustomerLedgerEntry", ref obj1, "@Voucher_ID", Vouch_ID, "@Ledger_ID", By_ID, "@Amount", payment.Amount, "@Type", "Cr.", "@Invoice_Date", System.Convert.ToDateTime(payment.Entry_Date)); if (payment.Equals(0) || payment == null) { return(Content(HttpStatusCode.NotFound, "Payment Not Saved")); } return(Ok(payment)); }