Beispiel #1
0
        public DayEndCashupReport GetDayEndCashupReport(DayEndCashupQuery query)
        {
            //...Create New Instance of Object...
            DayEndCashupReport ins = new DayEndCashupReport();

            //...Database Connection...
            DataBaseConnection dbConn = new DataBaseConnection();
            SqlConnection      con    = dbConn.SqlConn();
            SqlCommand         cmdI   = new SqlCommand();

            cmdI.CommandTimeout = 540;
            cmdI.Connection     = con;
            cmdI.CommandText    = "f_Admin_Report_DayEndCashUp";
            cmdI.CommandType    = System.Data.CommandType.StoredProcedure;
            cmdI.Parameters.AddWithValue("@date", query.Date);

            cmdI.Connection.Open();

            SqlDataReader drI = cmdI.ExecuteReader();

            //...Retrieve Data...
            if (drI.HasRows)
            {
                while (drI.Read())
                {
                    ins.ActualCash    = Convert.ToDecimal(drI["ActualCash"]);
                    ins.Cashbox       = Convert.ToDecimal(drI["Cashbox"]);
                    ins.CashDeclared  = Convert.ToDecimal(drI["CashDeclared"]);
                    ins.CashReceived  = Convert.ToDecimal(drI["CashReceived"]);
                    ins.Change        = Convert.ToDecimal(drI["Change"]);
                    ins.CounterTotal  = Convert.ToDecimal(drI["CounterTotal"]);
                    ins.DeclaredSlips = Convert.ToDecimal(drI["DeclaredSlips"]);
                    ins.SassaTotal    = Convert.ToDecimal(drI["SassaTotal"]);
                    ins.SigmaTotal    = Convert.ToDecimal(drI["SigmaTotal"]);
                    ins.StartUpFloats = Convert.ToDecimal(drI["StartUpFloats"]);
                    ins.Transits      = Convert.ToDecimal(drI["Transits"]);
                }
            }

            //...Close Connections...
            cmdI.Connection.Close();
            con.Dispose();

            //...Return...
            return(ins);
        }
        public DayEndCashupReport GetDayEndCashupReport(DayEndCashupQuery query)
        {
            //...Create New Instance of Object...
            DayEndCashupReport ins = new DayEndCashupReport();

            //...Database Connection...
            DataBaseConnection dbConn = new DataBaseConnection();
            SqlConnection con = dbConn.SqlConn();
            SqlCommand cmdI = new SqlCommand();
            cmdI.CommandTimeout = 540;
            cmdI.Connection = con;
            cmdI.CommandText = "f_Admin_Report_DayEndCashUp";
            cmdI.CommandType = System.Data.CommandType.StoredProcedure;
            cmdI.Parameters.AddWithValue("@date", query.Date);

            cmdI.Connection.Open();

            SqlDataReader drI = cmdI.ExecuteReader();

            //...Retrieve Data...
            if (drI.HasRows)
            {
                while (drI.Read())
                {
                    ins.ActualCash = Convert.ToDecimal(drI["ActualCash"]);
                    ins.Cashbox = Convert.ToDecimal(drI["Cashbox"]);
                    ins.CashDeclared = Convert.ToDecimal(drI["CashDeclared"]);
                    ins.CashReceived = Convert.ToDecimal(drI["CashReceived"]);
                    ins.Change = Convert.ToDecimal(drI["Change"]);
                    ins.CounterTotal = Convert.ToDecimal(drI["CounterTotal"]);
                    ins.DeclaredSlips = Convert.ToDecimal(drI["DeclaredSlips"]);
                    ins.SassaTotal = Convert.ToDecimal(drI["SassaTotal"]);
                    ins.SigmaTotal = Convert.ToDecimal(drI["SigmaTotal"]);
                    ins.StartUpFloats = Convert.ToDecimal(drI["StartUpFloats"]);
                    ins.Transits = Convert.ToDecimal(drI["Transits"]);
                }
            }

            //...Close Connections...
            cmdI.Connection.Close();
            con.Dispose();

            //...Return...
            return ins;
        }
        public ActionResult GetDayEndCashupReport(DayEndCashupQuery ins)
        {
            DayEndCashupReport report = reportrepo.GetDayEndCashupReport(ins);
            decimal ExpectedClosing = ins.OpeningBalance + report.SigmaTotal
                                       + report.CounterTotal + report.Change
                                        - ins.PettyCash - report.SassaTotal - report.Cashbox
                                        - report.Transits;
            decimal Shortage = report.CashReceived - report.StartUpFloats - report.SigmaTotal;

            StringWriter sw = new StringWriter();
            sw.WriteLine("\"Opening Balance\",\"{0}\"", ins.OpeningBalance);
            sw.WriteLine("\"Sigma Cash Sales\",\"{0}\"", report.SigmaTotal);
            sw.WriteLine("\"Cash Counter Netto\",\"{0}\"", report.CounterTotal);
            sw.WriteLine("\"Change Movement\",\"{0}\"", report.Change);
            sw.WriteLine("\"Cash transactions (Petty cash Total)\",\"{0}\"", ins.PettyCash);
            sw.WriteLine("\"Sassa Payouts\",\"{0}\"", report.SassaTotal);
            sw.WriteLine("\"Total dropped in Cashbox for today\",\"{0}\"", report.Cashbox);
            sw.WriteLine("\"Transits\",\"{0}\"", report.Transits);
            sw.WriteLine("\"Expected Closing Balance\",\"{0}\"", ExpectedClosing);
            sw.WriteLine("\"Actual Cash\",\"{0}\"", report.ActualCash);
            sw.WriteLine("\"Day End: {0}\",\"{1}\"", (((ExpectedClosing - report.ActualCash) < 0) ? "Shortage" : "Over"), (ExpectedClosing - report.ActualCash));
            sw.WriteLine("\" \"");
            sw.WriteLine("\"SIGMA CASHIER - CASH RECON\"");
            sw.WriteLine("\"Cash Expected\",\"{0}\"", report.SigmaTotal);
            sw.WriteLine("\"Cash Received\",\"{0}\"", report.CashReceived);
            sw.WriteLine("\"Startup Floats\",\"{0}\"", report.StartUpFloats);
            sw.WriteLine("\"Shortage\",\"{0}\"", Shortage);
            sw.WriteLine("\"Sassa Payouts\",\"{0}\"", report.SassaTotal);
            sw.WriteLine("\"{0}\",\"{1}\"", (((Shortage + report.SassaTotal) > 0) ? "Over" : "Short"), (Shortage + report.SassaTotal));
            sw.WriteLine("\" \"");
            sw.WriteLine("\"SIGMA CASHIER - CARD RECON\"");
            sw.WriteLine("\"Sigma Cards Expected\",\"{0}\"", ins.SigmaCardsExpected);
            sw.WriteLine("\"Declared Slips Total\",\"{0}\"", report.DeclaredSlips);
            sw.WriteLine("\"CARDS NOT CAPTURED\",\"{0}\"", (ins.SigmaCardsExpected - report.DeclaredSlips));
            sw.WriteLine("\" \"");
            sw.WriteLine("\"PAYZONE CASHIERS\"");
            sw.WriteLine("\"Cash Expected\",\"{0}\"", report.CounterTotal);
            sw.WriteLine("\"Cash Received\",\"{0}\"", report.CashDeclared);
            sw.WriteLine("\"{0}\",\"{1}\"", (((report.CashDeclared - report.CounterTotal) > 0) ? "Over" : "Short"), (report.CashDeclared - report.CounterTotal));

            string name = DateTime.Now.Year.ToString() + DateTime.Now.Month.ToString() + DateTime.Now.Day.ToString();

            Response.ClearContent();
            Response.AddHeader("content-disposition", "attachment;filename=DayEndCashup_" + ins.Date.ToShortDateString() + "_" + name + ".csv");
            Response.ContentType = "text/csv";

            Response.Write(sw.ToString());
            Response.End();
            return null;
        }