Exemple #1
0
        private void UpdateCheckout()
        {
            string cashier = "";

            if (cboCashier.SelectedIndex > -1)
            {
                dgvChkOut.Rows.Clear();
                clsUsers SelectedUser = lstUsers.Find(x => x.UserName == cboCashier.Text);
                int      userid       = SelectedUser != null ? SelectedUser.UserId : 0;
                TotalLoadingStationCashIn  = clsReloadHistory.GetLoadingStationTotalCashIn(dtPickStart.Value, dtPickEnd.Value, userid);
                TotalLoadingStationCashOut = clsReloadHistory.GetLoadingStationTotalCashOut(dtPickStart.Value, dtPickEnd.Value, userid);

                cashier = cboCashier.SelectedItem.ToString();
                SearchExpenses(dtPickStart.Value, dtPickEnd.Value, cashier);
                salesinfo     = GetTotalSales(dtPickStart.Value, dtPickEnd.Value, cashier);
                totalSales    = salesinfo[0] - salesinfo[3];
                TotalPayments = clsPaymentInfo.GetTotalPaymentsInfoFromDate(dtPickStart.Value, dtPickEnd.Value, cashier);

                initCash     = clsInitCash.GetInitialCash(dtPickStart.Value, cashier);
                depositCash  = clsDepositCash.GetDepositCash(dtPickStart.Value, cashier);
                expectedCOH  = totalSales + initCash - depositCash - TotalExpenses + TotalPayments;
                expectedCOH += TotalLoadingStationCashIn + TotalLoadingStationCashOut;

                //lblTotalCashinLoading.Text = string.Format("Loading Station Cash In: P {0:0.00}", TotalLoadingStationCashIn);
                //lblTotalCashoutLoading.Text = string.Format("Loading Station Cash Out: P {0:0.00}", TotalLoadingStationCashOut);

                //lblTotalSales.Text = string.Format("Total Sales: P {0:0.00}", totalSales);
                //lblInitCash.Text = string.Format("Initial Cash: P {0:0.00}", initCash);
                //lblDeposit.Text = string.Format("Deposit Cash: P {0:0.00}", depositCash);
                //lblReceivable.Text = string.Format("Total Charges: P {0:0.00}", salesinfo[1]);
                //lblTotalPayments.Text = string.Format("Total Payments: P {0:0.00}", TotalPayments);
                //lblExpectedCOH.Text = string.Format("Expected Cash on Hand: P {0:0.00}", expectedCOH);
                //actualCOH = clsCheckOut.GetActualCOH(dtPickStart.Value, cashier);
                //lblActualCash.Text = string.Format("Actual Cash on Hand: P {0:0.00}", actualCOH);
                //lblDiff.Text = string.Format("Amount Difference: P {0:0.00} [{1}]", actualCOH - expectedCOH, (actualCOH - expectedCOH > 0 ? "Over" : (actualCOH - expectedCOH == 0 ? "Match" : "Short")));

                int chkId = clsCheckOut.GetCheckOutID(dtPickStart.Value, cashier);
                if (chkId > 0)
                {
                    lstCheckOutItems = clsCheckOutItem.GetCheckOutItems(chkId);
                    if (lstCheckOutItems.Count > 0)
                    {
                        for (int i = 0; i < lstCheckOutItems.Count; i++)
                        {
                            clsCheckOutItem itemCheckout = lstCheckOutItems[i];
                            AddItemToGrid(itemCheckout);
                        }
                    }
                }
                else
                {
                    CreateCheckOutItems();
                    return;
                }
                if (isCheckout)
                {
                    CreateCheckOutItems();
                }
            }
        }
Exemple #2
0
        private void AddItemToGrid(clsCheckOutItem item)
        {
            int rowidx = dgvChkOut.Rows.Add();

            dgvChkOut.Rows[rowidx].Cells[0].Value = item.Description;
            dgvChkOut.Rows[rowidx].Cells[1].Value = item.ExpectedAmount.ToString("n");
            dgvChkOut.Rows[rowidx].Cells[2].Value = item.ActualAmount.ToString("n");

            dgvChkOut.Rows[rowidx].Cells[3].Value = item.Remarks;
        }
Exemple #3
0
        private void CreateCheckOutItems()
        {
            lstCheckOutItems = new List <clsCheckOutItem>();
            clsCheckOutItem item = new clsCheckOutItem()
            {
                Description    = "Initial Cash",
                ExpectedAmount = initCash,
                ActualAmount   = initCash
            };

            if (item.ActualAmount - item.ExpectedAmount != 0)
            {
                item.Remarks = string.Format("{0} [{1:0.00}]", item.ActualAmount - item.ExpectedAmount > 0 ? "Over" : (item.ActualAmount - item.ExpectedAmount == 0 ? "Match" : "Short"), item.ActualAmount - item.ExpectedAmount);
            }
            else
            {
                item.Remarks = "Match";
            }
            lstCheckOutItems.Add(item);
            AddItemToGrid(item);

            item = new clsCheckOutItem()
            {
                Description    = "Expenses",
                ExpectedAmount = TotalExpenses,
                ActualAmount   = TotalExpenses
            };
            if (item.ActualAmount - item.ExpectedAmount != 0)
            {
                item.Remarks = string.Format("{0} [{1:0.00}]", item.ActualAmount - item.ExpectedAmount > 0 ? "Over" : (item.ActualAmount - item.ExpectedAmount == 0 ? "Match" : "Short"), item.ActualAmount - item.ExpectedAmount);
            }
            else
            {
                item.Remarks = "Match";
            }
            lstCheckOutItems.Add(item);
            AddItemToGrid(item);

            item = new clsCheckOutItem()
            {
                Description    = "Deposit Cash",
                ExpectedAmount = depositCash,
                ActualAmount   = depositCash
            };
            if (item.ActualAmount - item.ExpectedAmount != 0)
            {
                item.Remarks = string.Format("{0} [{1:0.00}]", item.ActualAmount - item.ExpectedAmount > 0 ? "Over" : (item.ActualAmount - item.ExpectedAmount == 0 ? "Match" : "Short"), item.ActualAmount - item.ExpectedAmount);
            }
            else
            {
                item.Remarks = "Match";
            }
            lstCheckOutItems.Add(item);
            AddItemToGrid(item);

            item = new clsCheckOutItem()
            {
                Description    = "Total Sales",
                ExpectedAmount = totalSales,
                ActualAmount   = totalSales
            };
            if (item.ActualAmount - item.ExpectedAmount != 0)
            {
                item.Remarks = string.Format("{0} [{1:0.00}]", item.ActualAmount - item.ExpectedAmount > 0 ? "Over" : (item.ActualAmount - item.ExpectedAmount == 0 ? "Match" : "Short"), item.ActualAmount - item.ExpectedAmount);
            }
            else
            {
                item.Remarks = "Match";
            }
            lstCheckOutItems.Add(item);
            AddItemToGrid(item);

            item = new clsCheckOutItem()
            {
                Description    = "Total Charges",
                ExpectedAmount = salesinfo[1],
                ActualAmount   = salesinfo[1]
            };
            if (item.ActualAmount - item.ExpectedAmount != 0)
            {
                item.Remarks = string.Format("{0} [{1:0.00}]", item.ActualAmount - item.ExpectedAmount > 0 ? "Over" : (item.ActualAmount - item.ExpectedAmount == 0 ? "Match" : "Short"), item.ActualAmount - item.ExpectedAmount);
            }
            else
            {
                item.Remarks = "Match";
            }
            lstCheckOutItems.Add(item);
            AddItemToGrid(item);

            item = new clsCheckOutItem()
            {
                Description    = "Loading Station Cash In",
                ExpectedAmount = TotalLoadingStationCashIn,
                ActualAmount   = TotalLoadingStationCashIn
            };
            if (item.ActualAmount - item.ExpectedAmount != 0)
            {
                item.Remarks = string.Format("{0} [{1:0.00}]", item.ActualAmount - item.ExpectedAmount > 0 ? "Over" : (item.ActualAmount - item.ExpectedAmount == 0 ? "Match" : "Short"), item.ActualAmount - item.ExpectedAmount);
            }
            else
            {
                item.Remarks = "Match";
            }
            lstCheckOutItems.Add(item);
            AddItemToGrid(item);

            item = new clsCheckOutItem()
            {
                Description    = "Loading Station Cash Out",
                ExpectedAmount = TotalLoadingStationCashOut,
                ActualAmount   = TotalLoadingStationCashOut
            };
            if (item.ActualAmount - item.ExpectedAmount != 0)
            {
                item.Remarks = string.Format("{0} [{1:0.00}]", item.ActualAmount - item.ExpectedAmount > 0 ? "Over" : (item.ActualAmount - item.ExpectedAmount == 0 ? "Match" : "Short"), item.ActualAmount - item.ExpectedAmount);
            }
            else
            {
                item.Remarks = "Match";
            }
            lstCheckOutItems.Add(item);
            AddItemToGrid(item);


            List <clsLoadAccount> lstLoadAccount = clsLoadAccount.GetLoadAccounts();

            if (lstLoadAccount.Count > 0)
            {
                foreach (clsLoadAccount account in lstLoadAccount)
                {
                    item = new clsCheckOutItem()
                    {
                        Description    = account.Description,
                        ExpectedAmount = account.AvailableBalance,
                        ActualAmount   = 0
                    };
                    if (isCheckout)
                    {
                        double   remainingBal = account.AvailableBalance;
                        frmInput input        = new frmInput();
                        input.Title   = "Actual Remaining Balance";
                        input.Value   = "0";
                        input.Caption = account.Description;
                        if (input.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                        {
                            item.ActualAmount = double.Parse(input.Value);
                        }
                    }
                    if (item.ActualAmount - item.ExpectedAmount != 0)
                    {
                        item.Remarks = string.Format("{0} [{1:0.00}]", item.ActualAmount - item.ExpectedAmount > 0 ? "Over" : (item.ActualAmount - item.ExpectedAmount == 0 ? "Match" : "Short"), item.ActualAmount - item.ExpectedAmount);
                    }
                    else
                    {
                        item.Remarks = "Match";
                    }
                    lstCheckOutItems.Add(item);
                    AddItemToGrid(item);
                }
            }

            item = new clsCheckOutItem()
            {
                Description    = "Cash on Hand",
                ExpectedAmount = expectedCOH,
                ActualAmount   = actualCOH,
            };
            if (item.ActualAmount - item.ExpectedAmount != 0)
            {
                item.Remarks = string.Format("{0} [{1:0.00}]", item.ActualAmount - item.ExpectedAmount > 0 ? "Over" : (item.ActualAmount - item.ExpectedAmount == 0 ? "Match" : "Short"), item.ActualAmount - item.ExpectedAmount);
            }
            else
            {
                item.Remarks = "Match";
            }
            lstCheckOutItems.Add(item);
            AddItemToGrid(item);
        }