Пример #1
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 }));
        }
        public bool CheckSalaryStatusForAdvancePayment(decimal decEmployeeId, DateTime date)
        {
            bool isStatus = false;

            try
            {
                isStatus = SPMonthlySalary.CheckSalaryStatusForAdvancePayment(decEmployeeId, date);
            }
            catch (Exception ex)
            {
                MessageBox.Show("MS7:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            return(isStatus);
        }
Пример #3
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 }));
        }