Example #1
0
        public string SubmitEODDetail(string TotalSale, string TotalDiscount, string TotalCardPayment, string TotalCounterCash, string EodDate)
        {
            GetStoreId();
            if (string.IsNullOrEmpty(EodDate))
            {
                EodDate = DateTime.Now.ToString();
            }
            List <clsEODDetails>   dayBeforeEOD      = objDal.GetDayBeforeEODDetail(StoreId);
            List <clsEODDetails>   TodayEOD          = objDal.GetDayBeforeEODDetail(StoreId, EodDate);
            List <clsAdvance>      todayAdvance      = objDal.GetAdvanceList(StoreId, EodDate);
            List <clsDeposit>      todayDeposit      = objDal.GetDepositList(StoreId, EodDate);
            List <clsPartyPayment> todayPartyPayment = objDal.GetPartyPaymentList(StoreId, EodDate);
            List <clsExpense>      todayExpense      = objDal.GeExpanseList(StoreId, EodDate, false);

            decimal vtodayExpense      = 0;
            decimal vtodayAdvance      = 0;
            decimal vtodayDeposit      = 0;
            decimal vtodayPartyPayment = 0;
            decimal vshortageAmount    = 0;

            if (TodayEOD.Count == 0)
            {
                if (todayPartyPayment.Count > 0)
                {
                    vtodayPartyPayment = Convert.ToDecimal(todayPartyPayment.Sum(x => Convert.ToDecimal(x.PaymentAmount)));
                }
                if (todayExpense.Count > 0)
                {
                    vtodayExpense = Convert.ToDecimal(todayExpense.Sum(x => Convert.ToDecimal(x.ExpenseAmount)));
                }
                if (todayAdvance.Count > 0)
                {
                    vtodayAdvance = Convert.ToDecimal(todayAdvance.Sum(x => Convert.ToDecimal(x.AdvanceAmount)));
                }
                if (todayDeposit.Count > 0)
                {
                    vtodayDeposit = Convert.ToDecimal(todayDeposit.Sum(x => Convert.ToDecimal(x.DepositAmount)));
                }
                if (dayBeforeEOD.Count > 0)
                {
                    if (!String.IsNullOrEmpty(TotalSale) && !String.IsNullOrEmpty(TotalDiscount) && !String.IsNullOrEmpty(TotalSale) && !String.IsNullOrEmpty(TotalCounterCash))
                    {
                        vshortageAmount = (dayBeforeEOD[0].CounterCash + ((Convert.ToDecimal(TotalSale) - (vtodayDeposit + vtodayExpense + vtodayAdvance + vtodayPartyPayment + Convert.ToDecimal(TotalCardPayment != "" ? TotalCardPayment : "0") + Convert.ToDecimal(TotalDiscount != "" ? TotalDiscount : "0"))))) - Convert.ToDecimal(TotalCounterCash != "" ? TotalCounterCash : "0");
                    }
                    else
                    {
                        return("-2");//"Please complete the form.";
                    }
                }
                else
                {
                    vshortageAmount = -0;
                }

                if (!String.IsNullOrEmpty(TotalSale) && !String.IsNullOrEmpty(TotalDiscount) && !String.IsNullOrEmpty(TotalSale) && !String.IsNullOrEmpty(TotalCounterCash))
                {
                    if (0 <= objDal.SaveEODDetail(float.Parse(TotalSale), float.Parse(TotalCardPayment), float.Parse(TotalDiscount), float.Parse(TotalCounterCash), float.Parse(vshortageAmount.ToString()), StoreId, EodDate))
                    {
                        //string error = "";
                        return("1");// +objDal.CreateDataBackup();
                    }
                    else
                    {
                        return("-1");
                    }
                }
                else
                {
                    return("-2");//"Please complete the form.";
                }
            }
            else
            {
                return("-3");//"Oops!! You already submitted EOD for Today .";
            }
        }