Exemplo n.º 1
0
        public accounting_journal Start(AccountingJournalDB AccountingJournalDB, purchase_invoice purchase_invoice)
        {
            ///PURCHASE
            if (purchase_invoice != null &&
                purchase_invoice.accounting_journal == null &&
                purchase_invoice.status == entity.Status.Documents_General.Approved)
            {
                DateTime TransDate = purchase_invoice.trans_date;

                accounting_cycle accounting_cycledb = AccountingJournalDB.accounting_cycle
                                                      .Where(i => i.start_date <= TransDate &&
                                                             i.end_date >= TransDate &&
                                                             i.id_company == Properties.Settings.Default.company_ID)
                                                      .FirstOrDefault();

                if (accounting_cycledb == null)
                {
                    AccountingCycle AccCycle = new AccountingCycle();
                    int             CylceID  = AccCycle.Generate_Cycle(TransDate).id_cycle;
                    accounting_cycledb = AccountingJournalDB.accounting_cycle.Where(x => x.id_cycle == CylceID).FirstOrDefault();
                }

                return(Calculate_PurchaseInvoice(AccountingJournalDB, purchase_invoice, accounting_cycledb));
            }
            return(null);
        }
Exemplo n.º 2
0
        public accounting_journal Start(AccountingJournalDB AccountingJournalDB, sales_invoice sales_invoice)
        {
            if (sales_invoice != null &&
                sales_invoice.accounting_journal == null &&
                sales_invoice.status == entity.Status.Documents_General.Approved)
            {
                accounting_cycle accounting_cycledb = AccountingJournalDB.accounting_cycle
                                                      .Where(i =>
                                                             i.start_date <= sales_invoice.trans_date ||
                                                             i.end_date >= sales_invoice.trans_date &&
                                                             i.id_company == Properties.Settings.Default.company_ID)
                                                      .FirstOrDefault();

                if (accounting_cycledb == null)
                {
                    AccountingCycle AccCycle = new AccountingCycle();
                    int             id_cycle = AccCycle.Generate_Cycle(sales_invoice.trans_date).id_cycle;
                    accounting_cycledb = AccountingJournalDB.accounting_cycle.Where(x => x.id_cycle == id_cycle).FirstOrDefault();
                }

                //Check which Contract Detail has 0 Days == Cash
                return(calc(AccountingJournalDB, sales_invoice, accounting_cycledb));
            }
            return(null);
        }
Exemplo n.º 3
0
        //public class Payment_Calc
        //{
        public accounting_journal Start(AccountingJournalDB db, payment payment)
        {
            ///PURCHASE
            if (payment != null &&
                payment.accounting_journal == null &&
                payment.status == entity.Status.Documents_General.Approved)
            {
                accounting_cycle accounting_cycle;
                accounting_cycle accounting_cycledb = db.accounting_cycle.Where(i => i.start_date <= payment.trans_date || i.end_date >= payment.trans_date).FirstOrDefault();

                if (accounting_cycledb == null)
                {
                    AccountingCycle AccCycle = new AccountingCycle();
                    accounting_cycle = AccCycle.Generate_Cycle(payment.trans_date);
                }
                else
                {
                    accounting_cycle = accounting_cycledb;
                }

                return(Calculate_Payment(db, payment, accounting_cycle));
            }
            return(null);
        }