protected override void doUpdateNoTransaction(EventJournal en)
        {
            try
            {
                CustomerInvoiceJournal e = (CustomerInvoiceJournal)en;
                m_command.CommandText = e.GetUpdateSQL();
                m_command.ExecuteNonQuery();

                foreach (CustomerInvoiceJournalItem sti in e.EVENT_JOURNAL_ITEMS)
                {
                    if (sti.ID > 0)
                    {
                        m_command.CommandText = sti.GetUpdateSQL();
                        m_command.ExecuteNonQuery();
                    }
                    else
                    {
                        m_command.CommandText = sti.GetInsertSQL();
                        m_command.ExecuteNonQuery();
                        m_command.CommandText = CustomerInvoiceJournalItem.SelectMaxIDSQL();
                        sti.ID = Convert.ToInt32(m_command.ExecuteScalar());
                    }
                }
                m_command.CommandText = CustomerInvoiceJournalItem.DeleteUpdate(e.ID, e.EVENT_JOURNAL_ITEMS);
                m_command.ExecuteNonQuery();
            }
            catch (Exception x)
            {
                throw x;
            }
        }
        public int RecordCount()
        {
            m_command.CommandText = CustomerInvoiceJournal.RecordCount();
            int result = Convert.ToInt32(m_command.ExecuteScalar());

            return(result);
        }
        internal static CustomerInvoiceJournalItem FindCIJournalItemlistForReceipt(MySql.Data.MySqlClient.MySqlCommand cmd, int cusinvItemID)
        {
            cmd.CommandText = CustomerInvoiceJournalItem.GetByIDSQL(cusinvItemID);
            MySql.Data.MySqlClient.MySqlDataReader r      = cmd.ExecuteReader();
            CustomerInvoiceJournalItem             result = CustomerInvoiceJournalItem.TransformReader(r);

            r.Close();
            cmd.CommandText = CustomerInvoiceJournal.GetByIDSQL(result.EVENT_JOURNAL.ID);
            r = cmd.ExecuteReader();
            result.EVENT_JOURNAL = CustomerInvoiceJournal.TransformReader(r);
            r.Close();

            cmd.CommandText = Currency.GetByIDSQLStatic(result.CURRENCY.ID);
            r = cmd.ExecuteReader();
            result.CURRENCY = Currency.GetCurrency(r);
            r.Close();

            cmd.CommandText = TermOfPayment.GetByIDSQLStatic(result.TOP.ID);
            r          = cmd.ExecuteReader();
            result.TOP = TermOfPayment.GetTOP(r);
            r.Close();

            cmd.CommandText = Employee.GetByIDSQLStatic(result.EMPLOYEE.ID);
            r = cmd.ExecuteReader();
            result.EMPLOYEE = Employee.GetEmployee(r);
            r.Close();


            return(result);
        }
        protected override void doUpdate(EventJournal en)
        {
            MySql.Data.MySqlClient.MySqlTransaction trc = m_connection.BeginTransaction();
            m_command.Transaction = trc;
            try
            {
                CustomerInvoiceJournal e = (CustomerInvoiceJournal)en;
                m_command.CommandText = e.GetUpdateSQL();
                m_command.ExecuteNonQuery();

                foreach (CustomerInvoiceJournalItem sti in e.EVENT_JOURNAL_ITEMS)
                {
                    if (sti.ID > 0)
                    {
                        m_command.CommandText = sti.GetUpdateSQL();
                        m_command.ExecuteNonQuery();
                    }
                    else
                    {
                        m_command.CommandText = sti.GetInsertSQL();
                        m_command.ExecuteNonQuery();
                        m_command.CommandText = CustomerInvoiceJournalItem.SelectMaxIDSQL();
                        sti.ID = Convert.ToInt32(m_command.ExecuteScalar());
                    }
                }
                m_command.CommandText = CustomerInvoiceJournalItem.DeleteUpdate(e.ID, e.EVENT_JOURNAL_ITEMS);
                m_command.ExecuteNonQuery();
                trc.Commit();
            }
            catch (Exception x)
            {
                trc.Rollback();
                throw x;
            }
        }
        protected override void doSaveNoTransaction(EventJournal e)
        {
            try
            {
                DateTime     trDate     = DateTime.Today;
                string       codesample = AutoNumberSetupRepository.GetCodeSampleByDomainName(m_command, "CustomerInvoiceJournal");
                EventJournal codeDate   = FindLastCodeAndTransactionDate(codesample);
                string       lastCode   = codeDate == null ? string.Empty : codeDate.CODE;
                DateTime     lastDate   = codeDate == null ? trDate : codeDate.TRANSACTION_DATE;
                int          trCount    = RecordCount();
                e.CODE = AutoNumberSetupRepository.GetAutoNumberByDomainName(m_command, "CustomerInvoiceJournal", e.CODE, lastCode, lastDate, trDate, trCount == 0);

                CustomerInvoiceJournal stk = (CustomerInvoiceJournal)e;
                m_command.CommandText = stk.GetInsertSQL();
                m_command.ExecuteNonQuery();
                m_command.CommandText = CustomerInvoiceJournal.SelectMaxIDSQL();
                stk.ID = Convert.ToInt32(m_command.ExecuteScalar());
                foreach (CustomerInvoiceJournalItem item in stk.EVENT_JOURNAL_ITEMS)
                {
                    m_command.CommandText = item.GetInsertSQL();
                    m_command.ExecuteNonQuery();
                    m_command.CommandText = CustomerInvoiceJournalItem.SelectMaxIDSQL();
                    item.ID = Convert.ToInt32(m_command.ExecuteScalar());
                }
            }
            catch (Exception x)
            {
                e.ID = 0;
                foreach (EventJournalItem item in e.EVENT_JOURNAL_ITEMS)
                {
                    item.ID = 0;
                }
                throw x;
            }
        }
Exemplo n.º 6
0
        protected override void doRevise(EventJournal events, Period p)
        {
            foreach (ReceiptItem item in events.EVENT_JOURNAL_ITEMS)
            {
                item.CURRENCY = events.CURRENCY;
                item.VENDOR   = events.VENDOR;
                SetVendorBalance(item, p);
                item.ProcessUnPosted();
                updateVendorBalances(item.VENDOR_BALANCE);
                deleteVendorBalanceEntry(item.VENDOR_BALANCE_ENTRY);
                item.CUSTOMER_INVOICE_JOURNAL_ITEM.UnSetOSAgainstReceiptItem(item);
                if (item.CUSTOMER_INVOICE_JOURNAL_ITEM is CustomerInvoiceJournalItem)
                {
                    CustomerInvoiceJournalRepository.UpdateAgainstStatus(m_command, item.CUSTOMER_INVOICE_JOURNAL_ITEM.GET_EVENT_JOURNAL,
                                                                         item.CUSTOMER_INVOICE_JOURNAL_ITEM);
                    CustomerInvoiceJournal cij = (CustomerInvoiceJournal)((CustomerInvoiceJournalItem)item.CUSTOMER_INVOICE_JOURNAL_ITEM).EVENT_JOURNAL;
                    if (cij.POS_INVOICE.ID > 0)
                    {
                        throw new Exception("POS Receipt can not revise, please revise POS");
                    }
                }
                if (item.CUSTOMER_INVOICE_JOURNAL_ITEM is CustomerOutStandingInvoiceItem)
                {
                    CustomerOutStandingInvoiceRepository.UpdateAgainstStatus(m_command, item.CUSTOMER_INVOICE_JOURNAL_ITEM.GET_EVENT_JOURNAL,
                                                                             item.CUSTOMER_INVOICE_JOURNAL_ITEM);
                }
                //if (item.PAYMENT_TYPE == ReceiptType.ARCreditNote)
                //{

                //}
            }
        }
Exemplo n.º 7
0
        protected override void doRevise(Event events, Period p)
        {
            foreach (EventItem item in events.EVENT_ITEMS)
            {
                SetStockCard(item, p);
            }

            CustomerInvoiceJournal sij = (CustomerInvoiceJournal)r_cij.FindCIJbyPOSId(events.ID);

            if (sij == null)
            {
                throw new Exception("Customer Invoice Journal is missing");
            }

            ReceiptItem rec = r_receipt.FindReceiptItemByCIJ(((CustomerInvoiceJournalItem)sij.EVENT_JOURNAL_ITEMS[0]).ID);

            if (rec == null)
            {
                throw new Exception("Receipt is missing");
            }

            r_receipt.ReviseForPOSNoTransaction(rec.EVENT_JOURNAL.ID);
            r_receipt.DeleteNoTransaction(rec.EVENT_JOURNAL);

            r_cij.ReviseNoTransaction(sij.ID);
            r_cij.DeleteNoTransaction(sij);
        }
Exemplo n.º 8
0
        public static IList TransformReaderList(MySql.Data.MySqlClient.MySqlDataReader r)
        {
            IList result = new ArrayList();

            while (r.Read())
            {
                CustomerInvoiceJournal tr = new CustomerInvoiceJournal();
                tr.ID                        = Convert.ToInt32(r["cij_id"]);
                tr.CODE                      = r["cij_code"].ToString();
                tr.TRANSACTION_DATE          = Convert.ToDateTime(r["cij_date"]);
                tr.VENDOR                    = new Customer(Convert.ToInt32(r["cus_id"]));
                tr.CURRENCY                  = new Currency(Convert.ToInt32(r["ccy_id"]));
                tr.VENDOR_BALANCE_ENTRY_TYPE = VendorBalanceEntryType.CustomerInvoice;
                tr.NOTES                     = r["cij_notes"].ToString();
                tr.POSTED                    = Convert.ToBoolean(r["cij_posted"]);
                tr.EVENT_STATUS              = (EventStatus)Enum.Parse(typeof(EventStatus), r["cij_eventstatus"].ToString());
                tr.SUBTOTAL_AMOUNT           = Convert.ToDouble(r["cij_subtotalamount"]);
                tr.DISC_PERCENT              = Convert.ToDouble(r["cij_discpercent"]);
                tr.AMOUNT_AFTER_DISC_PERCENT = Convert.ToDouble(r["cij_amountafterdiscpercent"]);
                tr.DISC_AMOUNT               = Convert.ToDouble(r["cij_discamount"]);
                tr.AMOUNT_AFTER_DISC_AMOUNT  = Convert.ToDouble(r["cij_amountafterdiscamount"]);
                tr.OTHER_EXPENSE             = Convert.ToDouble(r["cij_otherexpense"]);
                tr.NET_AMOUNT                = Convert.ToDouble(r["cij_netamount"]);
                tr.EMPLOYEE                  = new Employee(Convert.ToInt32(r["emp_id"]));
                tr.CUSTOMER_INVOICE          = new CustomerInvoice(Convert.ToInt32(r["ci_id"]));
                tr.AGAINST_RECEIPT_STATUS    = (AgainstStatus)Enum.Parse(typeof(AgainstStatus), r["cij_againstreceiptstatus"].ToString());
                tr.POS_INVOICE               = new POS(Convert.ToInt32(r["pos_id"]));
                tr.MODIFIED_BY               = r["modified_by"].ToString();
                tr.MODIFIED_DATE             = Convert.ToDateTime(r["modified_date"].ToString());
                tr.MODIFIED_COMPUTER_NAME    = r["modified_computer"].ToString();
                result.Add(tr);
            }
            return(result);
        }
        private EventStatus getEventStatus(int id)
        {
            m_command.CommandText = CustomerInvoiceJournal.GetEventStatus(id);
            object      b = m_command.ExecuteScalar();
            EventStatus m = (EventStatus)Enum.Parse(typeof(EventStatus), b.ToString());

            return(m);
        }
        public override EventJournal FindLastCodeAndTransactionDate(string codesample)
        {
            m_command.CommandText = CustomerInvoiceJournal.FindLastCodeAndTransactionDate(codesample);
            MySql.Data.MySqlClient.MySqlDataReader r = m_command.ExecuteReader();
            EventJournal e = CustomerInvoiceJournal.TransformReader(r);

            r.Close();
            return(e);
        }
        public static void UpdateAgainstStatus(MySql.Data.MySqlClient.MySqlCommand cmd, EventJournal e, ICustomerInvoiceJournalItem ei)
        {
            CustomerInvoiceJournal     po  = (CustomerInvoiceJournal)e;
            CustomerInvoiceJournalItem poi = (CustomerInvoiceJournalItem)ei;

            cmd.CommandText = poi.UpdateAgainstStatus();
            cmd.ExecuteNonQuery();
            cmd.CommandText = po.UpdateAgainstStatus();
            cmd.ExecuteNonQuery();
        }
 protected override bool doIsCodeExist(string code)
 {
     try
     {
         m_command.CommandText = CustomerInvoiceJournal.SelectCountByCode(code);
         int t = Convert.ToInt32(m_command.ExecuteScalar());
         return(t > 0);
     }
     catch (Exception x)
     {
         throw x;
     }
 }
Exemplo n.º 13
0
        protected override void doRevise(Event events, Period p)
        {
            foreach (EventItem item in events.EVENT_ITEMS)
            {
                SetStockCard(item, p);
            }
            CustomerInvoiceJournal sij = (CustomerInvoiceJournal)r_sij.FindPeriodCIJId(events.ID);

            if (sij == null)
            {
                throw new Exception("Customer Invoice Journal is missing");
            }
            r_sij.ReviseNoTransaction(sij.ID);
            r_sij.DeleteNoTransaction(sij);
        }
        //public static CustomerInvoiceJournalItem FindGRNItem(MySql.Data.MySqlClient.MySqlCommand cmd, int grnIID)
        //{
        //    cmd.CommandText = CustomerInvoiceJournalItem.FindByGrnItemIDSQL(grnIID);
        //    MySql.Data.MySqlClient.MySqlDataReader r = cmd.ExecuteReader();
        //    CustomerInvoiceJournalItem res = CustomerInvoiceJournalItem.TransformReader(r);
        //    r.Close();
        //    cmd.CommandText = CustomerInvoiceJournal.GetByIDSQL(res.EVENT.ID);
        //    r = cmd.ExecuteReader();
        //    res.EVENT = CustomerInvoiceJournal.TransformReader(r);
        //    r.Close();
        //    return res;
        //}

        protected override IList doSearch(string find)
        {
            try
            {
                m_command.CommandText = CustomerInvoiceJournal.GetSearch(find);
                MySql.Data.MySqlClient.MySqlDataReader r = m_command.ExecuteReader();
                IList rest = CustomerInvoiceJournal.TransformReaderList(r);
                r.Close();
                return(rest);
            }
            catch (Exception x)
            {
                throw x;
            }
        }
Exemplo n.º 15
0
        protected override void doConfirm(Event events, Period p)
        {
            foreach (EventItem item in events.EVENT_ITEMS)
            {
                SetStockCard(item, p);
            }
            CustomerInvoice si = (CustomerInvoice)events;

            CustomerInvoiceJournal sij = new CustomerInvoiceJournal();

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

            CustomerInvoiceJournalItem siji = new CustomerInvoiceJournalItem();

            siji.AMOUNT                    = si.NET_TOTAL;
            siji.CURRENCY                  = si.CURRENCY;
            siji.EVENT_JOURNAL             = sij;
            siji.VENDOR                    = si.CUSTOMER;
            siji.INVOICE_NO                = si.CODE;
            siji.INVOICE_DATE              = si.TRANSACTION_DATE;
            siji.TOP                       = si.TOP;
            siji.EMPLOYEE                  = si.EMPLOYEE;
            siji.DUE_DATE                  = si.DUE_DATE;
            siji.OUTSTANDING_AMOUNT        = si.NET_TOTAL;
            siji.VENDOR_BALANCE_ENTRY_TYPE = VendorBalanceEntryType.CustomerInvoice;

            sij.EVENT_JOURNAL_ITEMS.Add(siji);
            r_sij.SaveNoTransaction(sij);
            r_sij.ConfirmNoTransaction(sij.ID);
        }
        public CustomerInvoiceJournal FindCIJbyPOSId(int POSId)
        {
            string sql = CustomerInvoiceJournal.FindCustomerInvoiceJournalItembyPOSId(POSId);

            m_command.CommandText = sql;
            MySql.Data.MySqlClient.MySqlDataReader r = m_command.ExecuteReader();
            CustomerInvoiceJournal rest = CustomerInvoiceJournal.TransformReader(r);

            r.Close();
            if (rest == null)
            {
                return(null);
            }
            m_command.CommandText = CustomerInvoiceJournalItem.GetByEventIDSQL(rest.ID);
            r = m_command.ExecuteReader();
            rest.EVENT_JOURNAL_ITEMS = CustomerInvoiceJournalItem.TransformReaderList(r);
            r.Close();
            return(rest);
        }
        protected override void doDeleteNoTransaction(EventJournal e)
        {
            CustomerInvoiceJournal st = (CustomerInvoiceJournal)e;

            try
            {
                if (getEventStatus(st.ID) == EventStatus.Confirm)
                {
                    throw new Exception("Revise before delete");
                }
                m_command.CommandText = CustomerInvoiceJournalItem.DeleteAllByEventSQL(st.ID);
                m_command.ExecuteNonQuery();
                m_command.CommandText = CustomerInvoiceJournal.DeleteSQL(st.ID);
                m_command.ExecuteNonQuery();
            }
            catch (Exception x)
            {
                throw x;
            }
        }
        public IList FindCIJournalItemlistForReceipt(string find, int ccyID, int customer, DateTime trdate, IList notIn)
        {
            StringBuilder poisSB = new StringBuilder();

            foreach (int i in notIn)
            {
                poisSB.Append(i.ToString());
                poisSB.Append(',');
            }
            string pois = poisSB.ToString();

            pois = notIn.Count > 0 ? pois.Substring(0, pois.Length - 1) : "";
            m_command.CommandText = CustomerInvoiceJournalItem.GetSearchForReceipt(find, ccyID, customer, pois, trdate);
            MySql.Data.MySqlClient.MySqlDataReader r = m_command.ExecuteReader();
            IList result = CustomerInvoiceJournalItem.TransformReaderList(r);

            r.Close();
            foreach (CustomerInvoiceJournalItem t in result)
            {
                m_command.CommandText = CustomerInvoiceJournal.GetByIDSQL(t.EVENT_JOURNAL.ID);
                r = m_command.ExecuteReader();
                t.EVENT_JOURNAL = CustomerInvoiceJournal.TransformReader(r);
                r.Close();

                m_command.CommandText = Currency.GetByIDSQLStatic(t.CURRENCY.ID);
                r          = m_command.ExecuteReader();
                t.CURRENCY = Currency.GetCurrency(r);
                r.Close();

                m_command.CommandText = TermOfPayment.GetByIDSQLStatic(t.TOP.ID);
                r     = m_command.ExecuteReader();
                t.TOP = TermOfPayment.GetTOP(r);
                r.Close();

                m_command.CommandText = Employee.GetByIDSQLStatic(t.EMPLOYEE.ID);
                r          = m_command.ExecuteReader();
                t.EMPLOYEE = Employee.GetEmployee(r);
                r.Close();
            }
            return(result);
        }
Exemplo n.º 19
0
 public void ReviseForPOSNoTransaction(int id)
 {
     try
     {
         EventJournal events = this.Get(id);
         if (events.EVENT_STATUS == EventStatus.Entry)
         {
             throw new Exception("Status is already Unposted/Entry");
         }
         Period p = AssertValidPeriod(events.TRANSACTION_DATE);
         foreach (ReceiptItem item in events.EVENT_JOURNAL_ITEMS)
         {
             item.CURRENCY = events.CURRENCY;
             item.VENDOR   = events.VENDOR;
             SetVendorBalance(item, p);
             item.ProcessUnPosted();
             updateVendorBalances(item.VENDOR_BALANCE);
             deleteVendorBalanceEntry(item.VENDOR_BALANCE_ENTRY);
             item.CUSTOMER_INVOICE_JOURNAL_ITEM.UnSetOSAgainstReceiptItem(item);
             if (item.CUSTOMER_INVOICE_JOURNAL_ITEM is CustomerInvoiceJournalItem)
             {
                 CustomerInvoiceJournalRepository.UpdateAgainstStatus(m_command, item.CUSTOMER_INVOICE_JOURNAL_ITEM.GET_EVENT_JOURNAL,
                                                                      item.CUSTOMER_INVOICE_JOURNAL_ITEM);
                 CustomerInvoiceJournal cij = (CustomerInvoiceJournal)((CustomerInvoiceJournalItem)item.CUSTOMER_INVOICE_JOURNAL_ITEM).EVENT_JOURNAL;
             }
             //if (item.CUSTOMER_INVOICE_JOURNAL_ITEM is CustomerOutStandingInvoiceItem)
             //{
             //    CustomerOutStandingInvoiceRepository.UpdateAgainstStatus(m_command, item.CUSTOMER_INVOICE_JOURNAL_ITEM.GET_EVENT_JOURNAL,
             //        item.CUSTOMER_INVOICE_JOURNAL_ITEM);
             //}
         }
         events.ProcessUnPosted();
         this.UpdateStatus(events, false);
     }
     catch (Exception x)
     {
         throw x;
     }
 }
        protected override EventJournal doGet(int ID)
        {
            m_command.CommandText = CustomerInvoiceJournal.GetByIDSQL(ID);
            MySql.Data.MySqlClient.MySqlDataReader r = m_command.ExecuteReader();
            CustomerInvoiceJournal st = CustomerInvoiceJournal.TransformReader(r);

            r.Close();
            m_command.CommandText = CustomerInvoiceJournalItem.GetByEventIDSQL(ID);
            r = m_command.ExecuteReader();
            IList stis = CustomerInvoiceJournalItem.TransformReaderList(r);

            r.Close();
            foreach (CustomerInvoiceJournalItem sti in stis)
            {
                sti.EVENT_JOURNAL = st;
                //sti.VENDOR = PartRepository.GetByID(m_command, sti.PART.ID);
                sti.VENDOR_BALANCE_ENTRY = VendorBalanceEntryRepository.FindVendorBalanceEntryByEventItem(m_command, sti.ID, sti.VENDOR_BALANCE_ENTRY_TYPE);
                //sti.GRN_ITEM = GoodReceiveNoteRepository.FindGoodReceiveNoteItem(m_command, sti.GRN_ITEM.ID);
                //sti.GRN_ITEM.PART = PartRepository.GetByID(m_command, sti.GRN_ITEM.PART.ID);
                st.EVENT_JOURNAL_ITEMS.Add(sti);
            }
            return(st);
        }
        protected override void doDelete(EventJournal e)
        {
            CustomerInvoiceJournal st = (CustomerInvoiceJournal)e;

            MySql.Data.MySqlClient.MySqlTransaction trc = m_connection.BeginTransaction();
            m_command.Transaction = trc;
            try
            {
                if (getEventStatus(st.ID) == EventStatus.Confirm)
                {
                    throw new Exception("Revise before delete");
                }
                m_command.CommandText = CustomerInvoiceJournalItem.DeleteAllByEventSQL(st.ID);
                m_command.ExecuteNonQuery();
                m_command.CommandText = CustomerInvoiceJournal.DeleteSQL(st.ID);
                m_command.ExecuteNonQuery();
                trc.Commit();
            }
            catch (Exception x)
            {
                trc.Rollback();
                throw x;
            }
        }
Exemplo n.º 22
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);
        }
 protected override void doUpdateStatus(EventJournal e, bool posted)
 {
     m_command.CommandText = CustomerInvoiceJournal.GetUpdateStatusSQL(e);
     m_command.ExecuteNonQuery();
 }