public void DailySalaryVoucherDetailsDelete(decimal DailySalaryVoucherDetailsId)
 {
     try
     {
         spDetails.DailySalaryVoucherDetailsDelete(DailySalaryVoucherDetailsId);
     }
     catch (Exception ex)
     {
         MessageBox.Show("BR1:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
예제 #2
0
        public string  EditDailySalaryVoucher(string dailyMasterId, string voucherTypeId, string voucherNo, string date,
                                              string salaryDate, string cash, string narration, string totalAmount, string details)
        {
            string message = string.Empty;

            try
            {
                DailySalaryVoucherMasterInfo  infoMaster  = new DailySalaryVoucherMasterInfo();
                DailySalaryVoucherMasterSP    spMaster    = new DailySalaryVoucherMasterSP();
                DailySalaryVoucherDetailsInfo infoDetails = new DailySalaryVoucherDetailsInfo();
                DailySalaryVoucherDetailsSP   spDetails   = new DailySalaryVoucherDetailsSP();
                LedgerPostingSP spLedgerPosting           = new LedgerPostingSP();

                infoMaster.DailySalaryVoucehrMasterId = Convert.ToDecimal(dailyMasterId);
                infoMaster.Date        = Convert.ToDateTime(date);
                infoMaster.LedgerId    = Convert.ToDecimal(cash);
                infoMaster.Narration   = narration;
                infoMaster.TotalAmount = Convert.ToDecimal(totalAmount);
                infoMaster.VoucherNo   = voucherNo;
                infoMaster.InvoiceNo   = voucherNo;

                infoMaster.Extra1          = string.Empty;
                infoMaster.Extra2          = string.Empty;
                infoMaster.SuffixPrefixId  = 0;//decDailySuffixPrefixId;
                infoMaster.VoucherTypeId   = Convert.ToDecimal(voucherTypeId);
                infoMaster.FinancialYearId = PublicVariables._decCurrentFinancialYearId;
                infoMaster.SalaryDate      = Convert.ToDateTime(salaryDate);
                infoDetails.Extra1         = string.Empty; // Fields not in design//
                infoDetails.Extra2         = string.Empty; // Fields not in design//
                spMaster.DailySalaryVoucherMasterEdit(infoMaster);
                List <Dictionary <string, object> > detailsData = JsonConvert.DeserializeObject <List <Dictionary <string, object> > >(details);

                int inRowCount = detailsData.Count;
                for (int i = 0; i < inRowCount; i++)
                {
                    if (detailsData[i]["employeeId"].GetType().Name != "JObject" && detailsData[i]["employeeId"].ToString() != string.Empty)
                    {
                        infoDetails.EmployeeId = Convert.ToDecimal(detailsData[i]["employeeId"].ToString());
                    }
                    if (detailsData[i]["dailyWage"].GetType().Name != "JObject" && detailsData[i]["dailyWage"].ToString() != string.Empty)
                    {
                        infoDetails.Wage = Convert.ToDecimal(detailsData[i]["dailyWage"].ToString());
                    }
                    if (detailsData[i]["status"].GetType().Name != "JObject" && detailsData[i]["status"].ToString() == "paid")
                    {
                        infoDetails.Status = detailsData[i]["status"].ToString();
                    }

                    if (detailsData[i]["status"].ToString() == "pending" && detailsData[i]["masterId"].GetType().Name != "JObject")
                    {
                        decimal DailySalaryVoucherDetailsId = Convert.ToDecimal(detailsData[i]["detailsId"].ToString());
                        spDetails.DailySalaryVoucherDetailsDelete(DailySalaryVoucherDetailsId);

                        LedgerUpdate(infoMaster);
                    }
                    else if (detailsData[i]["status"].ToString() == "pending" && detailsData[i]["masterId"].GetType().Name == "JObject")
                    {
                        spMaster.DailySalaryVoucherMasterEdit(infoMaster);
                        LedgerUpdate(infoMaster);
                    }
                    else if (detailsData[i]["status"].ToString() == "paid" && detailsData[i]["masterId"].GetType().Name == "JObject")
                    {
                        infoDetails.DailySalaryVocherMasterId = infoMaster.DailySalaryVoucehrMasterId;
                        spDetails.DailySalaryVoucherDetailsAdd(infoDetails);
                        //spMaster.DailySalaryVoucherMasterEdit(infoMaster);
                        LedgerUpdate(infoMaster);
                    }
                }
                if (spDetails.DailySalaryVoucherDetailsCount(infoMaster.DailySalaryVoucehrMasterId) == 0)
                {
                    spMaster.DailySalaryVoucherMasterDelete(infoMaster.DailySalaryVoucehrMasterId);
                }
            }
            catch (Exception ex)
            {
                message = ex.Message;
            }
            return(message);
        }