예제 #1
0
        protected override void doConfirm(Event events, Period p)
        {
            foreach (EventItem item in events.EVENT_ITEMS)
            {
                SetStockCard(item, p);
            }
            POS pos = (POS)events;

            CustomerInvoiceJournal cij = new CustomerInvoiceJournal();

            // sij.LastUpdate = DateTime.Now;
            // sij.ByTransaction = true;
            cij.CODE = pos.CODE;
            //sij.ComputerName = si.ComputerName;
            cij.CURRENCY         = pos.CURRENCY;
            cij.EVENT_STATUS     = EventStatus.Entry;
            cij.NOTES            = pos.NOTES;
            cij.NOTICE_DATE      = pos.NOTICE_DATE;
            cij.TRANSACTION_DATE = pos.TRANSACTION_DATE;
            // sij.UserName = si.UserName;
            cij.VENDOR      = pos.CUSTOMER;
            cij.POS_INVOICE = pos;
            cij.NET_AMOUNT  = pos.NET_TOTAL;
            cij.EMPLOYEE    = pos.EMPLOYEE;
            cij.VENDOR_BALANCE_ENTRY_TYPE = VendorBalanceEntryType.CustomerInvoice;


            CustomerInvoiceJournalItem ciji = new CustomerInvoiceJournalItem();

            ciji.AMOUNT                    = pos.NET_TOTAL;
            ciji.CURRENCY                  = pos.CURRENCY;
            ciji.EVENT_JOURNAL             = cij;
            ciji.VENDOR                    = pos.CUSTOMER;
            ciji.INVOICE_NO                = pos.CODE;
            ciji.INVOICE_DATE              = pos.TRANSACTION_DATE;
            ciji.TOP                       = pos.TOP;
            ciji.EMPLOYEE                  = pos.EMPLOYEE;
            ciji.DUE_DATE                  = pos.DUE_DATE;
            ciji.OUTSTANDING_AMOUNT        = pos.NET_TOTAL;
            ciji.VENDOR_BALANCE_ENTRY_TYPE = VendorBalanceEntryType.CustomerInvoice;

            cij.EVENT_JOURNAL_ITEMS.Add(ciji);
            r_cij.SaveNoTransaction(cij);
            r_cij.ConfirmNoTransaction(cij.ID);

            Receipt rc = new Receipt();

            rc.CURRENCY                  = cij.CURRENCY;
            rc.NET_AMOUNT                = cij.NET_AMOUNT;
            rc.NOTES                     = "Auto generate from POS Transaction";
            rc.NOTICE_DATE               = cij.NOTICE_DATE;
            rc.OTHER_EXPENSE             = cij.OTHER_EXPENSE;
            rc.SUBTOTAL_AMOUNT           = cij.SUBTOTAL_AMOUNT;
            rc.TRANSACTION_DATE          = cij.TRANSACTION_DATE;
            rc.VENDOR                    = cij.VENDOR;
            rc.VENDOR_BALANCE_ENTRY_TYPE = VendorBalanceEntryType.Receipt;
            rc.EMPLOYEE                  = cij.EMPLOYEE;

            ReceiptItem rci = new ReceiptItem();

            rci.EVENT_JOURNAL = rc;
            rci.AMOUNT        = ciji.AMOUNT;
            rci.CURRENCY      = rc.CURRENCY;
            rci.DUE_DATE      = rc.TRANSACTION_DATE;
            rci.EMPLOYEE      = rc.EMPLOYEE;
            rci.EVENT_JOURNAL = cij;
            rci.INVOICE_DATE  = cij.TRANSACTION_DATE;
            rci.INVOICE_NO    = cij.CODE;
            rci.NOTES         = "Autogenerate Payment from POS transaction";
            rci.PAYMENT_TYPE  = ReceiptType.Cash;
            rci.VENDOR_BALANCE_CUSTOMER_INVOICE_TYPE = VendorBalanceEntryType.Receipt;
            rci.VENDOR_BALANCE_ENTRY_TYPE            = VendorBalanceEntryType.Receipt;
            rci.VENDOR_BALANCE_TYPE           = VendorBalanceType.Customer;
            rci.CUSTOMER_INVOICE_JOURNAL_ITEM = ciji;
            rci.VENDOR = cij.VENDOR;
            rc.EVENT_JOURNAL_ITEMS.Add(rci);

            r_receipt.SaveNoTransaction(rc);
            r_receipt.ConfirmNoTransaction(rc.ID);
        }