public JsonResult GetDailySalaryVoucher(string dailySalaryMasterId) { bool isSuccess = true; string message = "success"; string jsonResults = ""; string jsonCombo = ""; DailySalaryVoucherMasterInfo info = new DailySalaryVoucherMasterInfo(); bool isAutomatic = false; try { DailySalaryVoucherMasterSP SpMaster = new DailySalaryVoucherMasterSP(); VoucherTypeSP spVoucherType = new VoucherTypeSP(); DataTable dtbl = new DataTable(); DailySalaryVoucherDetailsSP spDetails = new DailySalaryVoucherDetailsSP(); int nDailySalaryMasterId = int.Parse(dailySalaryMasterId); info = SpMaster.DailySalaryVoucherViewFromRegister(nDailySalaryMasterId); info.DailySalaryVoucehrMasterId = nDailySalaryMasterId; isAutomatic = spVoucherType.CheckMethodOfVoucherNumbering(info.VoucherTypeId); bool isEditMode = nDailySalaryMasterId > 0 ? true : false; dtbl = spDetails.DailySalaryVoucherDetailsGridViewAll(info.SalaryDate.ToString(), isEditMode, info.VoucherNo); jsonResults = Utils.ConvertDataTabletoString(dtbl); DailySalaryVoucherMasterSP spMaster = new DailySalaryVoucherMasterSP(); DataTable newDtbl = new DataTable(); newDtbl = spMaster.DailySalaryVoucherCashOrBankLedgersComboFill(); jsonCombo = Utils.ConvertDataTabletoString(newDtbl); } catch (Exception ex) { isSuccess = false; message = ex.Message; } return(Json(new { isSuccess = isSuccess, message = message, data = new { dailySalaryMasterId = info.DailySalaryVoucehrMasterId, voucherNo = info.VoucherNo, invoiceNo = info.InvoiceNo, date = info.Date.ToString("yyyy-MM-dd"), salaryDate = info.SalaryDate.ToString("yyyy-MM-dd"), totalAmount = info.TotalAmount, narration = info.Narration, suffixPrefixId = info.SuffixPrefixId, voucherTypeId = info.VoucherTypeId, ledgerId = info.LedgerId, jsonDetails = jsonResults, jsonCombo = jsonCombo } })); }
/// <summary> /// Function to check method fo voucher numbering based on parameter /// </summary> /// <param name="voucherTypeId"></param> /// <returns></returns> public bool CheckMethodOfVoucherNumbering(decimal voucherTypeId) { bool isAutomatic = false; try { isAutomatic = spVoucherType.CheckMethodOfVoucherNumbering(voucherTypeId); } catch (Exception ex) { MessageBox.Show("VT6:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } return(isAutomatic); }
public void CallFromVoucherTypeSelection() { VoucherTypeSP spVoucherType = new VoucherTypeSP(); DataTable dtblVouchetType = new DataTable(); dtblVouchetType = spVoucherType.VoucherTypeSelectionComboFill(strVoucherType); decimal decVoucherTypeId = (decimal)dtblVouchetType.Rows[0][0]; decPaymentVoucherTypeId = decVoucherTypeId; strPaymentVoucherTypeId = decVoucherTypeId.ToString(); isAutomatic = spVoucherType.CheckMethodOfVoucherNumbering(Convert.ToDecimal(decVoucherTypeId.ToString())); SuffixPrefixSP spSuffisprefix = new SuffixPrefixSP(); SuffixPrefixInfo infoSuffixPrefix = new SuffixPrefixInfo(); infoSuffixPrefix = spSuffisprefix.GetSuffixPrefixDetails(Convert.ToDecimal(strPaymentVoucherTypeId), dtpDate); decPaymentSuffixPrefixId = infoSuffixPrefix.SuffixprefixId; }
public string VoucherClear(string strVoucherNo, string dptVoucherDate, string editMode) { DataTable dtbl = new DataTable(); try { if (Convert.ToBoolean(editMode) == false) { decimal typeId = 27; VoucherTypeSP spVoucherType = new VoucherTypeSP(); var isAutomatic = spVoucherType.CheckMethodOfVoucherNumbering(typeId); return(voucherNumberGeneration(typeId, strVoucherNo, dptVoucherDate)); /*if (isAutomatic) * { * return voucherNumberGeneration(typeId, strVoucherNo, dptVoucherDate); * } * else * { * return string.Empty; * }*/ } //int inCount = dgvMonthlySalary.RowCount; //for (int i = 0; i < inCount; i++) //{ // dgvMonthlySalary.Rows[i].Cells["cmbStatus"].Value = null; //} return(string.Empty); } catch (Exception ex) { // MessageBox.Show("MSR2:" + ex.Message, "Masterfine", MessageBoxButtons.OK, MessageBoxIcon.Information); } return(string.Empty); }
public ActionResult GetAdvancePaymentEditDetails(string advancePaymentEditId) { try { decAdvancePaymentEditId = Convert.ToDecimal(advancePaymentEditId); AdvancePaymentSP spadvance = new AdvancePaymentSP(); AdvancePaymentInfo infoadvance = new AdvancePaymentInfo(); VoucherTypeSP spvouchertype = new VoucherTypeSP(); infoadvance = spadvance.AdvancePaymentView(decAdvancePaymentEditId); strVoucherNo = infoadvance.VoucherNo; string txtAdvanceVoucherNo = infoadvance.InvoiceNo; strInvoiceNo = infoadvance.InvoiceNo; string employeeId = infoadvance.EmployeeId.ToString(); string salaryMonth = infoadvance.SalaryMonth.ToString("yyyy-MM"); string txtDate = infoadvance.Date.ToString("yyyy-MM-dd"); string txtChequeDate = infoadvance.Date.ToString("yyyy-MM-dd"); string ledgerId = infoadvance.LedgerId.ToString(); string txtCheckNo = infoadvance.Chequenumber; string txtAmount = infoadvance.Amount.ToString(); string txtNarration = infoadvance.Narration; bool isBankAccount = false; decAdvancePaymentsId = decAdvancePaymentId; TransactionsGeneralFill obj = new TransactionsGeneralFill(); DataTable cashOrBank = obj.CashOrBankComboFill(false); DataTable employee = EmployeeComboFill(); string jsonCashOrBank = Utils.ConvertDataTabletoString(cashOrBank); string jsonEmployee = Utils.ConvertDataTabletoString(employee); if (cashOrBank.Rows.Count > 0) { decimal cashOrBankId = (decimal)cashOrBank.Rows[0][1]; string cashOrBankName = (string)cashOrBank.Rows[0][0]; isBankAccount = CheckWhetherBankOrCash(cashOrBankId, cashOrBankName); } decPaymentVoucherTypeId = infoadvance.VoucherTypeId; decPaymentSuffixPrefixId = infoadvance.SuffixPrefixId; isAutomatic = spvouchertype.CheckMethodOfVoucherNumbering(decPaymentVoucherTypeId); return(Json(new { success = "true", ex = "no", data = new { voucherNo = strVoucherNo, employee = jsonEmployee, employeeId, salaryMonth, chequeNo = txtCheckNo, date = txtDate, amount = txtAmount, cashOrBank = jsonCashOrBank, ledgerId, chequeDate = txtChequeDate, narration = txtNarration, isAutomatic, isBankAccount } })); } catch (Exception ex) { return(Json(new { success = "true", ex = "AP3:" + ex.Message })); } }
/// <summary> /// Function for edit /// </summary> public void EditFunction_MSV(string masterId, string tableData, string editMode) { try { List <Object> dgvMonthlySalary = JsonConvert.DeserializeObject <List <Object> >(tableData); JArray itemFirst = (JArray)dgvMonthlySalary[0]; string voucherNo = Convert.ToString(itemFirst[0]["voucherNo"].Value <string>()); string voucherDate = Convert.ToString(itemFirst[0]["voucherDate"].Value <string>()); string month = Convert.ToString(itemFirst[0]["month"].Value <string>()); string cash = Convert.ToString(itemFirst[0]["cash"].Value <string>()); string totalAmount = Convert.ToString(itemFirst[0]["totalAmount"].Value <string>()); string narration = Convert.ToString(itemFirst[0]["narration"].Value <string>()); SalaryVoucherMasterSP spMaster = new SalaryVoucherMasterSP(); SalaryVoucherMasterInfo infoMaster = new SalaryVoucherMasterInfo(); SalaryVoucherDetailsSP spDetails = new SalaryVoucherDetailsSP(); SalaryVoucherDetailsInfo infoDetails = new SalaryVoucherDetailsInfo(); LedgerPostingSP spLedgerPosting = new LedgerPostingSP(); decimal masterID = Convert.ToDecimal(masterId); infoMaster.SalaryVoucherMasterId = masterID; infoMaster.Date = Convert.ToDateTime(voucherDate); infoMaster.LedgerId = Convert.ToDecimal(cash); infoMaster.Narration = narration; infoMaster.TotalAmount = Convert.ToDecimal(totalAmount); bool isEditMode = Convert.ToBoolean(editMode); VoucherTypeSP spVoucherType = new VoucherTypeSP(); int decMonthlyVoucherTypeId = 27; decimal typeId = Convert.ToDecimal(decMonthlyVoucherTypeId); var isAutomatic = spVoucherType.CheckMethodOfVoucherNumbering(typeId); infoMaster.VoucherNo = voucherNo; infoMaster.InvoiceNo = voucherNo; infoMaster.Extra1 = string.Empty; infoMaster.Extra2 = string.Empty; infoMaster.SuffixPrefixId = Convert.ToDecimal(ViewData["decMonthlySuffixPrefixId"]); infoMaster.VoucherTypeId = typeId; infoMaster.FinancialYearId = PublicVariables._decCurrentFinancialYearId; infoMaster.Month = Convert.ToDateTime(month); infoDetails.Extra1 = string.Empty; infoDetails.Extra2 = string.Empty; int inRowCount = dgvMonthlySalary.Count; for (int i = 0; i < inRowCount; i++) { JArray item = (JArray)dgvMonthlySalary[i]; if (item[0]["txtEmployeeId"] != null) { infoDetails.EmployeeId = Convert.ToDecimal(item[0]["txtEmployeeId"].Value <string>()); } if (item[0]["txtBonus"] != null) { infoDetails.Bonus = Convert.ToDecimal(item[0]["txtBonus"].Value <string>()); } if (item[0]["txtDeduction"] != null) { infoDetails.Deduction = Convert.ToDecimal(item[0]["txtDeduction"].Value <string>()); } if (item[0]["txtAdvance"] != null) { infoDetails.Advance = Convert.ToDecimal(item[0]["txtAdvance"].Value <string>()); } if (item[0]["txtLop"] != null) { infoDetails.Lop = Convert.ToDecimal(item[0]["txtLop"].Value <string>()); } if (item[0]["txtSalary"] != null) { infoDetails.Salary = Convert.ToDecimal(item[0]["txtSalary"].Value <string>()); } if (item[0]["cmbStatus"] != null && Convert.ToString(item[0]["cmbStatus"].Value <string>()) == "Paid") { infoDetails.Status = Convert.ToString(item[0]["cmbStatus"].Value <string>()); } if (Convert.ToString(item[0]["cmbStatus"].Value <string>()) == "Pending" && Convert.ToString(item[0]["txtMasterId"].Value <string>()) != "0") { decimal SalaryVoucherDetailsId = Convert.ToDecimal(item[0]["txtDetailsId"].Value <string>()); spDetails.SalaryVoucherDetailsDelete(SalaryVoucherDetailsId); spMaster.SalaryVoucherMasterEdit(infoMaster); //LedgerUpdate(); } if (Convert.ToString(item[0]["cmbStatus"].Value <string>()) == "Paid" && Convert.ToString(item[0]["txtMasterId"].Value <string>()) == "0") { infoDetails.SalaryVoucherMasterId = masterID; spDetails.MonthlySalaryVoucherDetailsAdd(infoDetails); spMaster.SalaryVoucherMasterEdit(infoMaster); //LedgerUpdate(); } if (Convert.ToString(item[0]["cmbStatus"].Value <string>()) == "Pending" && Convert.ToString(item[0]["txtMasterId"].Value <string>()) == "0") { spMaster.SalaryVoucherMasterEdit(infoMaster); //LedgerUpdate(); } } if (spDetails.SalaryVoucherDetailsCount(masterID) == 0) { spMaster.SalaryVoucherMasterDelete(masterID); } //GridFillVoucher(isEditMode, Convert.ToDateTime(month), voucherNo); } catch (Exception ex) { //MessageBox.Show("MSV8:" + ex.Message, "Masterfine", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
public void SaveFunction_MSV(string tableData, string editMode) { try { List <Object> dgvMonthlySalary = JsonConvert.DeserializeObject <List <Object> >(tableData); JArray itemFirst = (JArray)dgvMonthlySalary[0]; string voucherNo = Convert.ToString(itemFirst[0]["voucherNo"].Value <string>()); string voucherDate = Convert.ToString(itemFirst[0]["voucherDate"].Value <string>()); string month = Convert.ToString(itemFirst[0]["month"].Value <string>()); string cash = Convert.ToString(itemFirst[0]["cash"].Value <string>()); string totalAmount = Convert.ToString(itemFirst[0]["totalAmount"].Value <string>()); string narration = Convert.ToString(itemFirst[0]["narration"].Value <string>()); SalaryVoucherMasterSP spMaster = new SalaryVoucherMasterSP(); SalaryVoucherMasterInfo infoMaster = new SalaryVoucherMasterInfo(); SalaryVoucherDetailsSP spDetails = new SalaryVoucherDetailsSP(); SalaryVoucherDetailsInfo infoDetails = new SalaryVoucherDetailsInfo(); DateTime dtpMonth = Convert.ToDateTime(month); bool isEditMode = Convert.ToBoolean(editMode); int decMonthlyVoucherTypeId = 27; decimal typeId = Convert.ToDecimal(decMonthlyVoucherTypeId); VoucherTypeSP spVoucherType = new VoucherTypeSP(); var isAutomatic = spVoucherType.CheckMethodOfVoucherNumbering(typeId); //------------------------------- In the case of multi user check whether salary is paying for the sam person ----------------// int inCounts = dgvMonthlySalary.Count; int incont = 0; decimal decVal = 0; string strEployeeNames = ""; for (int i = 0; i < inCounts; i++) { JArray item = (JArray)dgvMonthlySalary[i]; decVal = Convert.ToDecimal(item[0]["txtEmployeeId"].Value <string>()); if (spDetails.CheckWhetherSalaryAlreadyPaid(decVal, dtpMonth) != "0") { strEployeeNames = strEployeeNames + spDetails.CheckWhetherSalaryAlreadyPaid(decVal, dtpMonth) + ","; foreach (char ch in strEployeeNames) { if (ch == ',') { incont++; } } if (incont == 15) { incont = 0; strEployeeNames = strEployeeNames + Environment.NewLine; } } } if (spDetails.CheckWhetherSalaryAlreadyPaid(decVal, dtpMonth) != "0") { // Messages.InformationMessage("Salary already paid for - " + " " + strEployeeNames); //GridFillVoucher(isEditMode, dtpMonth, voucherNo); } infoMaster.LedgerId = Convert.ToDecimal(cash); infoMaster.VoucherNo = voucherNo; infoMaster.Month = Convert.ToDateTime(dtpMonth); infoMaster.Date = Convert.ToDateTime(voucherDate); infoMaster.Narration = narration; infoMaster.InvoiceNo = voucherNo; if (totalAmount != string.Empty) { infoMaster.TotalAmount = Math.Round(Convert.ToDecimal(totalAmount), PublicVariables._inNoOfDecimalPlaces); } infoMaster.Extra1 = string.Empty; // Fields not in design// infoMaster.Extra2 = string.Empty; // Fields not in design// infoMaster.SuffixPrefixId = Convert.ToDecimal(ViewData["decMonthlySuffixPrefixId"]); infoMaster.VoucherTypeId = typeId; infoMaster.FinancialYearId = PublicVariables._decCurrentFinancialYearId; int inCount = dgvMonthlySalary.Count; int inValue = 0; for (int i = 0; i < inCount; i++) { JArray item = (JArray)dgvMonthlySalary[i]; if (Convert.ToString(item[0]["cmbStatus"].Value <string>()) == "Paid") { inValue++; } } if (inValue > 0) { //-------------------------In the case of Multi-User Check the VoucherNo. again (Max of VoucherNumber )---------------------// DataTable dtbl = new DataTable(); decimal decMasterId = 0; string strUpdatedVoucherNo = "", strUpdatedInvoiceNo = ""; dtbl = spMaster.MonthlySalaryVoucherMasterAddWithIdentity(infoMaster, isAutomatic); foreach (DataRow dr in dtbl.Rows) { decMasterId = Convert.ToDecimal(dr.ItemArray[0].ToString()); strUpdatedVoucherNo = dr.ItemArray[1].ToString(); strUpdatedInvoiceNo = dr.ItemArray[2].ToString(); } string strVoucherNo = ""; string strInvoiceNo = ""; if (!isAutomatic) { strVoucherNo = voucherNo; } if (isAutomatic) { if (strUpdatedVoucherNo != "" && Convert.ToDecimal(strUpdatedVoucherNo) != Convert.ToDecimal(voucherNo)) { //Messages.InformationMessage("Voucher number changed from " + strInvoiceNo + " to " + strUpdatedInvoiceNo); strVoucherNo = strUpdatedVoucherNo.ToString(); strInvoiceNo = strUpdatedInvoiceNo; } } //LedgerPosting(Convert.ToDecimal(cash)); infoDetails.Extra1 = string.Empty; infoDetails.Extra2 = string.Empty; infoDetails.SalaryVoucherMasterId = decMasterId; int inRowCount = dgvMonthlySalary.Count; for (int i = 0; i < inRowCount; i++) { JArray item = (JArray)dgvMonthlySalary[i]; if (item[0]["txtEmployeeId"] != null) { infoDetails.EmployeeId = Convert.ToDecimal(item[0]["txtEmployeeId"].Value <string>()); } if (item[0]["txtBonus"] != null) { infoDetails.Bonus = Convert.ToDecimal(item[0]["txtBonus"].Value <string>()); } if (item[0]["txtDeduction"] != null) { infoDetails.Deduction = Convert.ToDecimal(item[0]["txtDeduction"].Value <string>()); } if (item[0]["txtAdvance"] != null) { infoDetails.Advance = Convert.ToDecimal(item[0]["txtAdvance"].Value <string>()); } if (item[0]["txtLop"] != null) { infoDetails.Lop = Convert.ToDecimal(item[0]["txtLop"].Value <string>()); } if (item[0]["txtSalary"] != null) { infoDetails.Salary = Convert.ToDecimal(item[0]["txtSalary"].Value <string>()); } if (item[0]["cmbStatus"] != null) { infoDetails.Status = Convert.ToString(item[0]["cmbStatus"].Value <string>()) == "Paid"? "Paid": string.Empty; } if (Convert.ToString(item[0]["cmbStatus"].Value <string>()) == "Paid" && Convert.ToString(item[0]["txtMasterId"].Value <string>()) == "0") { infoDetails.SalaryVoucherMasterId = decMasterId; spDetails.MonthlySalaryVoucherDetailsAdd(infoDetails); } } //GridFillVoucher(isEditMode,dtpMonth, voucherNo); VoucherClear(strVoucherNo, voucherDate, editMode); } else { //Messages.InformationMessage("Can't save without atleast one employee"); voucherNo = spMaster.SalaryVoucherMasterGetMax(typeId); } } catch (Exception ex) { //MessageBox.Show("MSV7:" + ex.Message, "Masterfine", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
public ActionResult SaveOrEdit(string masterId, string tableData, string editMode) { try { List <Object> dgvMonthlySalary = JsonConvert.DeserializeObject <List <Object> >(tableData); JArray itemFirst = (JArray)dgvMonthlySalary[0]; decimal masterID = Convert.ToDecimal(masterId); SalaryVoucherMasterSP spMaster = new SalaryVoucherMasterSP(); bool isEditMode = Convert.ToBoolean(editMode); int decMonthlyVoucherTypeId = 27; decimal typeId = Convert.ToDecimal(decMonthlyVoucherTypeId); VoucherTypeSP spVoucherType = new VoucherTypeSP(); var isAutomatic = spVoucherType.CheckMethodOfVoucherNumbering(typeId); string voucherNo = Convert.ToString(itemFirst[0]["voucherNo"].Value <string>()); if (isEditMode == false) { if (PublicVariables.isMessageAdd) { if (!isAutomatic) { if (spMaster.MonthlySalaryVoucherCheckExistence(voucherNo, typeId, masterID) == false) { SaveFunction_MSV(tableData, editMode); } } else { SaveFunction_MSV(tableData, editMode); } } else { if (!isAutomatic) { if (spMaster.MonthlySalaryVoucherCheckExistence(voucherNo, typeId, masterID) == false) { SaveFunction_MSV(tableData, editMode); } } else { SaveFunction_MSV(tableData, editMode); } } } //------ Update-------------// else if (isEditMode) { if (PublicVariables.isMessageEdit) { if (!isAutomatic) { if (spMaster.MonthlySalaryVoucherCheckExistence(voucherNo, typeId, masterID) == false) { EditFunction_MSV(masterId, tableData, editMode); } } else { EditFunction_MSV(masterId, tableData, editMode); } } else { if (!isAutomatic) { if (spMaster.MonthlySalaryVoucherCheckExistence(voucherNo, typeId, masterID) == false) { EditFunction_MSV(masterId, tableData, editMode); } } else { EditFunction_MSV(masterId, tableData, editMode); } } } return(Json(new { error = "success" })); } catch (Exception ex) { // MessageBox.Show("MSV6:" + ex.Message, "Masterfine", MessageBoxButtons.OK, MessageBoxIcon.Information); } return(Json(new { error = "error" })); }
public ActionResult FillFunction(string id) { try { DataTable dtbl = new DataTable(); SalaryVoucherMasterSP SpMaster = new SalaryVoucherMasterSP(); SalaryVoucherMasterInfo InfoMaster = new SalaryVoucherMasterInfo(); VoucherTypeSP spVoucherType = new VoucherTypeSP(); decimal masterId = Convert.ToDecimal(id); InfoMaster = SpMaster.SalaryVoucherMasterView(masterId); var strVoucherNoforEdit = InfoMaster.VoucherNo; var strVoucherNo = InfoMaster.VoucherNo; var strInvoiceNo = InfoMaster.InvoiceNo; var txtVoucherDate = InfoMaster.Date.ToString("yyyy-MM-dd"); var dtpMonth = Convert.ToDateTime(InfoMaster.Month.ToString("yyyy-MM")); var txtNarration = InfoMaster.Narration; string txtMonth = InfoMaster.Month.ToString("yyyy-MM"); decimal decTotalAmont = Math.Round(Convert.ToDecimal(InfoMaster.TotalAmount.ToString()), PublicVariables._inNoOfDecimalPlaces); var lblTotalAmount = decTotalAmont.ToString(); var decMonthlySuffixPrefixId = InfoMaster.SuffixPrefixId; var decMonthlyVoucherTypeId = InfoMaster.VoucherTypeId; ViewData["decMonthlyVoucherTypeId"] = decMonthlyVoucherTypeId; ViewData["decMonthlySuffixPrefixId"] = decMonthlySuffixPrefixId; var cmbCashOrBankAcc = InfoMaster.LedgerId; var isAutomatic = spVoucherType.CheckMethodOfVoucherNumbering(decMonthlyVoucherTypeId); bool txtInVoiceNoEnabled = false; if (isAutomatic) { txtInVoiceNoEnabled = false; } else { txtInVoiceNoEnabled = true; } bool dtpMonthEnabled = false; dtbl = GridFillVoucher(true, dtpMonth, strVoucherNo); string jsonResult = Utils.ConvertDataTabletoString(dtbl); return(Json(new { error = "false", data = jsonResult, voucherNo = strVoucherNo, strInvoiceNo, voucherDate = txtVoucherDate, month = txtMonth, cash = cmbCashOrBankAcc, totalAmount = lblTotalAmount, narration = txtNarration, txtInVoiceNoEnabled, dtpMonthEnabled, masterID = masterId })); } catch (Exception ex) { } return(Json(new{ error = "true" })); }