コード例 #1
0
        public static string calculateCustomerBalanceDates(int customerId, DateTime from, DateTime to)
        {
            float ret = getCustomerBalance(customerId);
            List <StatementItem> invoices = InvoiceViewModel.getInvoicesForStatement(customerId, from, to);

            for (int i = 0; i < invoices.Count; i++)
            {
                if (InvoiceViewModel.isInvoicePaid(invoices[i].idItem) == false)
                {
                    ret += invoices[i].charges;
                }
            }
            List <StatementItem> receipts = ReceiptViewModel.getReceiptsForStatement(customerId, from, to);

            for (int i = 0; i < receipts.Count; i++)
            {
                ret -= receipts[i].credits;
            }
            List <StatementItem> creditNotes = CreditNoteViewModel.getCreditNotesForStatement(customerId, from, to);

            for (int i = 0; i < creditNotes.Count; i++)
            {
                ret -= creditNotes[i].charges;
            }

            return(ret.ToString());
        }
コード例 #2
0
        public static float calculateCustomerBalance(int customerId)
        {
            float      ret      = getCustomerBalance(customerId);
            List <int> invoices = InvoiceViewModel.getCustomerInvoices(customerId);

            for (int i = 0; i < invoices.Count; i++)
            {
                if (InvoiceViewModel.isInvoicePaid(invoices[i]) == false)
                {
                    ret += InvoiceViewModel.getInvoiceCost(invoices[i]);
                }
            }
            List <int> receipts = ReceiptViewModel.getCustomerReceipts(customerId);

            for (int i = 0; i < receipts.Count; i++)
            {
                ret -= ReceiptViewModel.getReceiptAmount(receipts[i]);
            }
            List <int> creditNotes = CreditNoteViewModel.getCustomerCreditNotes(customerId);

            for (int i = 0; i < creditNotes.Count; i++)
            {
                ret -= CreditNoteViewModel.getCreditNoteCost(creditNotes[i]);
            }

            return(ret);
        }