Beispiel #1
0
        public void VoucherNoGeneration(DateTime salaryMonth)
        {
            TransactionsGeneralFill obj = new TransactionsGeneralFill();
            AdvancePaymentSP        spAdvancePayment = new AdvancePaymentSP();

            if (strVoucherNo == string.Empty)
            {
                strVoucherNo = "0";
            }
            strVoucherNo = obj.VoucherNumberAutomaicGeneration(decPaymentVoucherTypeId, Convert.ToDecimal(strVoucherNo), salaryMonth, strAdvancePayment);
            if (Convert.ToDecimal(strVoucherNo) != spAdvancePayment.AdvancePaymentGetMaxPlusOne(decPaymentVoucherTypeId))
            {
                strVoucherNo = spAdvancePayment.AdvancePaymentGetMax(decPaymentVoucherTypeId).ToString();
                strVoucherNo = obj.VoucherNumberAutomaicGeneration(decPaymentVoucherTypeId, Convert.ToDecimal(strVoucherNo), salaryMonth, strAdvancePayment);
                if (spAdvancePayment.AdvancePaymentGetMax(decPaymentVoucherTypeId) == "0")
                {
                    strVoucherNo = "0";
                    strVoucherNo = obj.VoucherNumberAutomaicGeneration(decPaymentVoucherTypeId, Convert.ToDecimal(strVoucherNo), salaryMonth, strAdvancePayment);
                }
            }
            if (isAutomatic)
            {
                SuffixPrefixSP   spSuffixPrefix   = new SuffixPrefixSP();
                SuffixPrefixInfo infoSuffixPrefix = new SuffixPrefixInfo();
                infoSuffixPrefix = spSuffixPrefix.GetSuffixPrefixDetails(decPaymentVoucherTypeId, dtpDate);
                string strPrefix = infoSuffixPrefix.Prefix;
                string strSuffix = infoSuffixPrefix.Suffix;
                strInvoiceNo = strPrefix + strVoucherNo + strSuffix;
            }
        }
Beispiel #2
0
        public bool CheckAdvanceAmount(string employeeId, string amount)
        {
            bool Cancel = true;

            try
            {
                decimal          decEmployeeId     = 0;
                AdvancePaymentSP spAdvancePayment  = new AdvancePaymentSP();
                decimal          decEmployeesalary = 0;
                if (employeeId != string.Empty)
                {
                    decEmployeeId = Convert.ToDecimal(employeeId);
                }
                decEmployeesalary = spAdvancePayment.AdvancePaymentAmountchecking(decEmployeeId);

                decimal txtamountvalue = 0;
                if (amount != string.Empty)
                {
                    txtamountvalue = Convert.ToDecimal(amount);
                }
                if (txtamountvalue > decEmployeesalary)
                {
                    Cancel = false;
                }
            }
            catch (Exception ex)
            {
            }
            return(Cancel);
        }
Beispiel #3
0
        public ActionResult DeleteAdvancePaymentFunction(string voucherNo, string employeeId, string salaryMonth)
        {
            string message = string.Empty;

            try
            {
                MonthlySalarySP spMonthlySalary = new MonthlySalarySP();
                if (!spMonthlySalary.CheckSalaryStatusForAdvancePayment(Convert.ToDecimal(employeeId), Convert.ToDateTime(salaryMonth)))
                {
                    AdvancePaymentInfo infoAdvancepayment = new AdvancePaymentInfo();
                    AdvancePaymentSP   spAdvancePayment   = new AdvancePaymentSP();
                    LedgerPostingSP    spLedgerPosting    = new LedgerPostingSP();
                    spAdvancePayment.AdvancePaymentDelete(Convert.ToDecimal(decAdvancePaymentEditId.ToString()));
                    spLedgerPosting.LedgerPostDelete(voucherNo, decAdvancePaymentEditId);
                }
                else
                {
                    message = "You can't delete,reference exist";
                }
            }
            catch (Exception ex)
            {
                return(Json(new { success = "false", ex = "AP4" + ex.Message, message }));
            }
            return(Json(new { success = "true", ex = "no", message }));
        }
Beispiel #4
0
 /// <summary>
 /// On 'Print' button click to take print
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnPrint_Click(object sender, EventArgs e)
 {
     try
     {
         if (dgvAdvancePayment.Rows.Count > 0)
         {
             DataSet   ds          = new DataSet();
             CompanySP spCompany   = new CompanySP();
             DataTable dtblCompany = spCompany.CompanyViewDataTable(1);
             ds.Tables.Add(dtblCompany);
             AdvancePaymentSP spAdvancePayment   = new AdvancePaymentSP();
             DataTable        dtblAdvancePayment = new DataTable();
             dtblAdvancePayment = spAdvancePayment.AdvancePaymentViewAllForAdvancePaymentReport(dtpFrmDate.Value, dtpToDate.Value, cmbEmployeeCode.Text, DateTime.Parse(dtpSalaryMonth.Text.ToString()));
             ds.Tables.Add(dtblAdvancePayment);
             frmReport frmReportObj = new frmReport();
             frmReportObj.MdiParent = formMDI.MDIObj;
             frmReportObj.AdvancePaymentReportPrinting(ds);
         }
         else
         {
             Messages.InformationMessage("No data found");
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("APR:8" + ex.Message, "Open Miracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Beispiel #5
0
 /// <summary>
 /// Function to fill Datagridview
 /// </summary>
 public void GridFill()
 {
     try
     {
         DataTable        dtblAdvancePayment = new DataTable();
         AdvancePaymentSP spAdvanceRegister  = new AdvancePaymentSP();
         dtblAdvancePayment            = spAdvanceRegister.AdvanceRegisterSearch(txtAdvanceVoucher.Text, txtEmployeeCode.Text, txtEmployeeName.Text, dtpSalaryMonth.Text, cmbVoucherType.Text);
         dgvAdvanceRegister.DataSource = dtblAdvancePayment;
     }
     catch (Exception ex)
     {
         MessageBox.Show("AR1:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Beispiel #6
0
 /// <summary>
 /// Function to fill Datagridview
 /// </summary>
 public void GridFill()
 {
     try
     {
         AdvancePaymentSP spAdvancePayment = new AdvancePaymentSP();
         DataTable        dtbl             = spAdvancePayment.AdvancePaymentViewAllForAdvancePaymentReport(dtpFrmDate.Value, dtpToDate.Value, cmbEmployeeCode.Text, dtpSalaryMonth.Value);
         dgvAdvancePayment.DataSource = dtbl;
         TotalAmount();
     }
     catch (Exception ex)
     {
         MessageBox.Show("APR:1 " + ex.Message, "Open Miracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Beispiel #7
0
        public DataTable EmployeeComboFill()
        {
            DataTable dtblspAdvancePayment = new DataTable();

            try
            {
                AdvancePaymentSP spAdvancePayment = new AdvancePaymentSP();
                dtblspAdvancePayment = spAdvancePayment.AdvancePaymentEmployeeComboFill();
            }
            catch (Exception ex)
            {
                //MessageBox.Show("AP12:" + ex.Message, "Masterfine", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            return(dtblspAdvancePayment);
        }
Beispiel #8
0
        public ActionResult GetAttendanceReigsterDetails(string voucherNo, string employeeCode, string employeeName, string salaryMonth, string voucherType)
        {
            string jsonComboData = string.Empty;
            string jsonTableData = string.Empty;

            try
            {
                DataTable        dtblAdvancePayment = new DataTable();
                AdvancePaymentSP spAdvanceRegister  = new AdvancePaymentSP();
                if (voucherNo == null)
                {
                    voucherNo = string.Empty;
                }
                if (employeeCode == null)
                {
                    employeeCode = string.Empty;
                }
                if (employeeName == null)
                {
                    employeeName = string.Empty;
                }

                DateTime dateTime = Convert.ToDateTime(salaryMonth);
                salaryMonth = dateTime.ToString("MMMM yyyy");

                dtblAdvancePayment = spAdvanceRegister.AdvanceRegisterSearch(voucherNo, employeeCode, employeeName, salaryMonth, voucherType);
                jsonTableData      = Utils.ConvertDataTabletoString(dtblAdvancePayment);

                AdvancePaymentSP spAdvancePaymentSP  = new AdvancePaymentSP();
                DataTable        dtblVoucherTypeName = new DataTable();
                dtblVoucherTypeName = spAdvancePaymentSP.VoucherTypeNameComboFillAdvanceRegister();
                DataRow dr = dtblVoucherTypeName.NewRow();
                dr[0] = "0";
                dr[1] = "All";
                dtblVoucherTypeName.Rows.InsertAt(dr, 0);
                jsonComboData = Utils.ConvertDataTabletoString(dtblVoucherTypeName);
            }
            catch (Exception ex)
            {
                return(Json(new { success = "true", ex = "AR2:" + ex.Message, tableData = string.Empty, comboData = string.Empty }));
            }
            return(Json(new { success = "true", ex = "no", tableData = jsonTableData, comboData = jsonComboData }));
        }
Beispiel #9
0
 /// <summary>
 /// Function to fill cmbVoucherType combobox
 /// </summary>
 public void VoucherTypeNameComboFill()
 {
     try
     {
         AdvancePaymentSP spAdvancePaymentSP  = new AdvancePaymentSP();
         DataTable        dtblVoucherTypeName = new DataTable();
         dtblVoucherTypeName = spAdvancePaymentSP.VoucherTypeNameComboFillAdvanceRegister();
         DataRow dr = dtblVoucherTypeName.NewRow();
         dr[1] = "All";
         dtblVoucherTypeName.Rows.InsertAt(dr, 0);
         cmbVoucherType.DataSource    = dtblVoucherTypeName;
         cmbVoucherType.ValueMember   = "voucherTypeId";
         cmbVoucherType.DisplayMember = "voucherTypeName";
     }
     catch (Exception ex)
     {
         MessageBox.Show("AR2:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Beispiel #10
0
        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 }));
            }
        }
Beispiel #11
0
        public void LedgerPosting(decimal decLedgerPostingId, decimal decAdvancePaymentId, string voucherNo, string selLedgerId, string amount)
        {
            try
            {
                AdvancePaymentSP   spAdvancePayment   = new AdvancePaymentSP();
                AdvancePaymentInfo infoAdvancePayment = new AdvancePaymentInfo();
                LedgerPostingSP    spLedgerPosting    = new LedgerPostingSP();
                LedgerPostingInfo  infoLedgerPosting  = new LedgerPostingInfo();
                infoLedgerPosting.VoucherTypeId = decPaymentVoucherTypeId;
                if (isAutomatic)
                {
                    infoLedgerPosting.VoucherNo = strVoucherNo;
                }
                else
                {
                    infoLedgerPosting.VoucherNo = voucherNo;
                }
                infoLedgerPosting.Date      = PublicVariables._dtCurrentDate;
                infoLedgerPosting.LedgerId  = Convert.ToDecimal(selLedgerId);
                infoLedgerPosting.DetailsId = decAdvancePaymentId;
                if (isAutomatic)
                {
                    infoLedgerPosting.InvoiceNo = strInvoiceNo;
                }
                else
                {
                    infoLedgerPosting.InvoiceNo = voucherNo;
                }
                infoLedgerPosting.YearId = PublicVariables._decCurrentFinancialYearId;
                infoLedgerPosting.Debit  = 0;
                infoLedgerPosting.Credit = Convert.ToDecimal(amount);

                infoLedgerPosting.ChequeNo   = string.Empty;
                infoLedgerPosting.ChequeDate = DateTime.Now;

                infoLedgerPosting.ExtraDate = DateTime.Now;
                infoLedgerPosting.Extra1    = string.Empty;
                infoLedgerPosting.Extra2    = string.Empty;
                spLedgerPosting.LedgerPostingAdd(infoLedgerPosting);
                infoLedgerPosting.VoucherTypeId = decPaymentVoucherTypeId;
                if (isAutomatic)
                {
                    infoLedgerPosting.VoucherNo = strVoucherNo;
                }
                else
                {
                    infoLedgerPosting.VoucherNo = voucherNo;
                }
                infoLedgerPosting.Date      = PublicVariables._dtCurrentDate;
                infoLedgerPosting.LedgerId  = 3;
                infoLedgerPosting.DetailsId = decAdvancePaymentId;
                if (isAutomatic)
                {
                    infoLedgerPosting.InvoiceNo = strInvoiceNo;
                }
                else
                {
                    infoLedgerPosting.InvoiceNo = voucherNo;
                }
                infoLedgerPosting.YearId = PublicVariables._decCurrentFinancialYearId;
                infoLedgerPosting.Debit  = Convert.ToDecimal(amount);
                infoLedgerPosting.Credit = 0;

                infoLedgerPosting.ChequeNo   = string.Empty;
                infoLedgerPosting.ChequeDate = DateTime.Now;

                infoLedgerPosting.ExtraDate = PublicVariables._dtCurrentDate;
                infoLedgerPosting.Extra1    = string.Empty;
                infoLedgerPosting.Extra2    = string.Empty;
                spLedgerPosting.LedgerPostingAdd(infoLedgerPosting);
            }
            catch (Exception ex)
            {
            }
        }
Beispiel #12
0
        public ActionResult EditAdvancePaymentFunction(string voucherNo, string employeeId, string salaryMonth, string chequeNo,
                                                       string date, string amount, string ledgerId, string chequeDate, string narration, string advancePaymentEditId)
        {
            string message        = string.Empty;
            string focus          = string.Empty;
            bool   amountReadOnly = false;

            try
            {
                employeeId              = employeeId ?? string.Empty;
                salaryMonth             = salaryMonth ?? string.Empty;
                chequeNo                = chequeNo ?? string.Empty;
                date                    = date ?? string.Empty;
                amount                  = amount ?? string.Empty;
                ledgerId                = ledgerId ?? string.Empty;
                chequeDate              = chequeDate ?? string.Empty;
                narration               = narration ?? string.Empty;
                decAdvancePaymentEditId = Convert.ToDecimal(advancePaymentEditId);
                MonthlySalarySP spMonthlySalary = new MonthlySalarySP();
                decimal         decEmployeeId   = Convert.ToDecimal(employeeId);
                DateTime        dtSalaryMonth   = Convert.ToDateTime(salaryMonth);
                if (!spMonthlySalary.CheckSalaryStatusForAdvancePayment(decEmployeeId, dtSalaryMonth))
                {
                    AdvancePaymentSP   spAdvancepayment   = new AdvancePaymentSP();
                    AdvancePaymentInfo infoAdvancepayment = new AdvancePaymentInfo();
                    LedgerPostingSP    spLedgerPosting    = new LedgerPostingSP();

                    if (spAdvancepayment.CheckSalaryAlreadyPaidOrNot(decEmployeeId, dtSalaryMonth))
                    {
                        amountReadOnly = true;
                    }

                    infoAdvancepayment.AdvancePaymentId = decAdvancePaymentEditId;
                    infoAdvancepayment.EmployeeId       = decEmployeeId;
                    infoAdvancepayment.SalaryMonth      = dtSalaryMonth;
                    infoAdvancepayment.Chequenumber     = chequeNo;
                    infoAdvancepayment.Date             = Convert.ToDateTime(date);
                    infoAdvancepayment.Amount           = Convert.ToDecimal(amount);
                    if (CheckAdvanceAmount(employeeId, amount))
                    {
                        if (isAutomatic)
                        {
                            infoAdvancepayment.VoucherNo = strVoucherNo;
                        }
                        else
                        {
                            infoAdvancepayment.VoucherNo = voucherNo;
                        }
                        if (isAutomatic)
                        {
                            infoAdvancepayment.InvoiceNo = strInvoiceNo;
                        }
                        else
                        {
                            infoAdvancepayment.InvoiceNo = voucherNo;
                        }
                        infoAdvancepayment.LedgerId        = Convert.ToDecimal(ledgerId);
                        infoAdvancepayment.ChequeDate      = Convert.ToDateTime(chequeDate);
                        infoAdvancepayment.Narration       = narration;
                        infoAdvancepayment.ExtraDate       = Convert.ToDateTime(DateTime.Now.ToString());
                        infoAdvancepayment.Extra1          = string.Empty;
                        infoAdvancepayment.Extra2          = string.Empty;
                        infoAdvancepayment.VoucherTypeId   = decPaymentVoucherTypeId;
                        infoAdvancepayment.SuffixPrefixId  = decPaymentSuffixPrefixId;
                        infoAdvancepayment.FinancialYearId = PublicVariables._decCurrentFinancialYearId;
                        message = spAdvancepayment.AdvancePaymentEdit(infoAdvancepayment);
                        message = LedgerUpdate(voucherNo, amount, ledgerId);
                    }
                    else
                    {
                        message = "Advance of this month exceeds than amount set for the employee";
                        focus   = "new_amount";
                    }
                }
                else
                {
                    message = "You can't update,reference exist";
                    focus   = "edit_salaryMonth";
                }
            }
            catch (Exception ex)
            {
                return(Json(new { success = "true", ex = "AP3" + ex.Message }));
            }
            return(Json(new { success = "true", ex = "no", focus, message, amountReadOnly }));
        }
Beispiel #13
0
        public ActionResult SaveAdvancePaymentFunction(string voucherNo, string employeeId, string salaryMonth, string chequeNo,
                                                       string date, string amount, string ledgerId, string chequeDate, string narration)
        {
            string exception    = string.Empty;
            string message      = string.Empty;
            string focus        = string.Empty;
            string newVoucherNo = string.Empty;

            try
            {
                employeeId  = employeeId ?? string.Empty;
                salaryMonth = salaryMonth ?? string.Empty;
                chequeNo    = chequeNo ?? string.Empty;
                date        = date ?? string.Empty;
                amount      = amount ?? string.Empty;
                ledgerId    = ledgerId ?? string.Empty;
                chequeDate  = chequeDate ?? string.Empty;
                narration   = narration ?? string.Empty;
                AdvancePaymentSP   spAdvancepayment   = new AdvancePaymentSP();
                AdvancePaymentInfo infoAdvancepayment = new AdvancePaymentInfo();
                LedgerPostingSP    spLedgerPosting    = new LedgerPostingSP();
                MonthlySalarySP    spMonthlySalary    = new MonthlySalarySP();

                if (CheckAdvanceAmount(employeeId, amount))
                {
                    if (!spMonthlySalary.CheckSalaryAlreadyPaidOrNotForAdvancePayment(Convert.ToDecimal(employeeId), Convert.ToDateTime(salaryMonth)))
                    {
                        if (!spAdvancepayment.CheckSalaryAlreadyPaidOrNot(Convert.ToDecimal(employeeId), Convert.ToDateTime(salaryMonth)))
                        {
                            if (isAutomatic == true)
                            {
                                infoAdvancepayment.VoucherNo = strVoucherNo;
                            }
                            else
                            {
                                infoAdvancepayment.VoucherNo = voucherNo;
                            }
                            infoAdvancepayment.EmployeeId   = Convert.ToDecimal(employeeId);
                            infoAdvancepayment.SalaryMonth  = Convert.ToDateTime(salaryMonth);
                            infoAdvancepayment.Chequenumber = chequeNo ?? string.Empty;
                            infoAdvancepayment.Date         = Convert.ToDateTime(date);
                            infoAdvancepayment.Amount       = Convert.ToDecimal(amount);
                            if (isAutomatic)
                            {
                                infoAdvancepayment.InvoiceNo = strInvoiceNo;
                            }
                            else
                            {
                                infoAdvancepayment.InvoiceNo = voucherNo;
                            }
                            infoAdvancepayment.LedgerId        = Convert.ToDecimal(ledgerId);
                            infoAdvancepayment.ChequeDate      = Convert.ToDateTime(chequeDate);
                            infoAdvancepayment.Narration       = narration;
                            infoAdvancepayment.ExtraDate       = DateTime.Now;
                            infoAdvancepayment.Extra1          = string.Empty;
                            infoAdvancepayment.Extra2          = string.Empty;
                            infoAdvancepayment.VoucherTypeId   = decPaymentVoucherTypeId;
                            infoAdvancepayment.SuffixPrefixId  = decPaymentSuffixPrefixId;
                            infoAdvancepayment.FinancialYearId = PublicVariables._decCurrentFinancialYearId;

                            if (decAdvancePaymentsId != -1)
                            {
                                DataTable dtbl = new DataTable();
                                dtbl = spAdvancepayment.AdvancePaymentAddWithIdentity(infoAdvancepayment, isAutomatic);
                                foreach (DataRow dr in dtbl.Rows)
                                {
                                    decAdvancePaymentId     = Convert.ToDecimal(dr.ItemArray[0].ToString());
                                    strUpdatedVoucherNumber = dr.ItemArray[1].ToString();
                                    strUpdatedInvoiceNumber = dr.ItemArray[2].ToString();
                                }
                                if (!isAutomatic)
                                {
                                    strVoucherNo = voucherNo;
                                }
                                if (isAutomatic)
                                {
                                    if (Convert.ToDecimal(strUpdatedVoucherNumber) != Convert.ToDecimal(strVoucherNo))
                                    {
                                        message      = "Voucher number changed from  " + strInvoiceNo + "  to  " + strUpdatedInvoiceNumber + ".";
                                        strVoucherNo = strUpdatedVoucherNumber.ToString();
                                        strInvoiceNo = strUpdatedInvoiceNumber;
                                        newVoucherNo = strVoucherNo;
                                    }
                                }
                                focus = "AdvanceVoucherNo";
                            }
                            LedgerPosting(Convert.ToDecimal(ledgerId), decAdvancePaymentId, voucherNo, ledgerId, amount);
                        }
                        else
                        {
                            message = "Advance already paid for this month.";
                            focus   = "new_salaryMonth";
                        }
                    }
                    else
                    {
                        message = "Cant pay advance for this month,Salary already paid.";
                        focus   = "new_salaryMonth";
                    }
                }
                else
                {
                    message = "Advance of this month exceeds than amount set for the employee";
                    focus   = "new_amount";
                }
            }
            catch (Exception ex)
            {
                return(Json(new { success = "true", ex = ex.Message }));
            }
            return(Json(new { success = "true", ex = "no", focus, message, newVoucherNo }));
        }