Esempio n. 1
0
 private void ChequePayEnter()
 {
     if (CurrenPurchase.chqAmount > 0.00m)
     {
         if (CurrenPurchase.chqAmount == CurrenPurchase.netAmount)
         {
             CurrenPurchase.invoiceType  = ConstValues.INVT_PAID;
             CurrenPurchase.payMethod    = ConstValues.INVT_CHEQUE;
             CurrenPurchase.creditAmount = CurrenPurchase.netAmount - (CurrenPurchase.payAmount + CurrenPurchase.chqAmount);
             CurrenChqueBook             = CurrenChqueBook.CreateNewChequeBook(branch, loggedUser.LoggedUser, CurrenPurchase);
             aggregator.GetEvent <UIElementFocusEvent>().Publish("chq");
         }
         else if (CurrenPurchase.chqAmount < CurrenPurchase.netAmount)
         {
             if (CurrenPurchase.chqAmount == CurrenPurchase.creditAmount)
             {
                 CurrenPurchase.invoiceType = ConstValues.INVT_PAID;
                 if ((CurrenPurchase.payAmount + CurrenPurchase.chqAmount) == CurrenPurchase.netAmount)
                 {
                     CurrenPurchase.payMethod = ConstValues.INVT_CASH_CHEQUE;
                 }
                 else
                 {
                     CurrenPurchase.payMethod = ConstValues.INVT_CHEQUE;
                 }
                 CurrenPurchase.creditAmount = CurrenPurchase.netAmount - (CurrenPurchase.payAmount + CurrenPurchase.chqAmount);
                 CurrenChqueBook             = CurrenChqueBook.CreateNewChequeBook(branch, loggedUser.LoggedUser, CurrenPurchase);
                 aggregator.GetEvent <UIElementFocusEvent>().Publish("chq");
             }
             else
             {
                 CurrenPurchase.creditAmount = CurrenPurchase.netAmount - (CurrenPurchase.payAmount + CurrenPurchase.chqAmount);
                 CurrenPurchase.invoiceType  = ConstValues.INVT_CREDIT;
                 CurrenPurchase.payMethod    = ConstValues.INVT_CHEQUE;
                 CurrenChqueBook             = CurrenChqueBook.CreateNewChequeBook(branch, loggedUser.LoggedUser, CurrenPurchase);
                 aggregator.GetEvent <UIElementFocusEvent>().Publish("chq");
             }
         }
         else
         {
             ShowMessageDialg("Purchasing", "Invoice Cheque Amount Greater Than to Net Amount", MsgDialogType.warrning);
             aggregator.GetEvent <UIElementFocusEvent>().Publish("chqa");
         }
     }
     else
     {
         CurrenPurchase.creditAmount = CurrenPurchase.netAmount - (CurrenPurchase.payAmount + CurrenPurchase.chqAmount);
         CurrenPurchase.invoiceType  = ConstValues.INVT_CREDIT;
         CurrenPurchase.payMethod    = ConstValues.INVT_CREDIT;
         aggregator.GetEvent <UIElementFocusEvent>().Publish("sav");
     }
 }
Esempio n. 2
0
        private async void EndPurchase()
        {
            IRestDataMapper mapper = containerExtension.Resolve <IRestDataMapper>();

            CurrenPurchase.recordState = ConstValues.RCS_FINE;
            _ = await PurchaseRestService.UpdatePurchaseAsync(mapper, CurrenPurchase);

            if (CurrenPurchase.creditAmount > 0.00m)
            {
                CurrenPurchase.invoiceType = ConstValues.INVT_CREDIT;
                CreditInvoice = CreditInvoice.CreateNewCreditInvoice(branch, loggedUser.LoggedUser, CurrenPurchase);
                SelectedSupplier.supplierCreditAccount.totalCredit += CurrenPurchase.creditAmount;
                _ = await SupplierCreditRestService.updateSupplierCreditAccountAsync(mapper, SelectedSupplier.supplierCreditAccount);

                _ = await SupplierCreditRestService.CreateSupplierCreditInvoiceAsync(mapper, CreditInvoice);
            }
            if (CurrenPurchase.payAmount > 0.00m)
            {
                CurrenCashBook = CurrenCashBook.CreateNewCashBook(branch, loggedUser.LoggedUser, CurrenPurchase);
                CurrenCashBook.branchAccount = SelectedBac;
                _ = await FinancialRestService.CreateCashBookAsync(mapper, CurrenCashBook);
            }
            if (CurrenPurchase.chqAmount > 0.00m)
            {
                CurrenChqueBook = CurrenChqueBook.CreateNewChequeBook(branch, loggedUser.LoggedUser, CurrenPurchase);
                CurrenChqueBook.branchAccount = SelectedBac;
                _ = await FinancialRestService.CreateChequeBookAsync(mapper, CurrenChqueBook);
            }
            SelectedStore       = null;
            SelectedUom         = null;
            SelectedItem        = null;
            SelectedItmCt       = null;
            CurrentPurchaseItem = null;
            CurrenPurchase      = null;
            SelectedSupCt       = null;
            SelectedSupplier    = null;
            CreditInvoice       = null;
            CurrenCashBook      = null;
            CurrenChqueBook     = null;
            PurchaseItems.Clear();
            Initialize();
        }