Example #1
0
        private void simpleButton2_Click(object sender, EventArgs e)
        {
            if (SelectedFinanceInvoiceDetail == null)
            {
                return;
            }

            DialogResult result =
                XtraMessageBox.Show("هـل تـريـــد حــذف الصنـــف ? " + "\r\n" + SelectedFinanceInvoiceDetail.InventoryItemName,
                                    "تنبيــــه", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1,
                                    DefaultBoolean.Default);

            switch (result)
            {
            case DialogResult.Yes:
                FinanceInvoiceDetailsList.Remove(SelectedFinanceInvoiceDetail);
                break;
            }

            grdInventoryItems.DataSource = FinanceInvoiceDetailsList;
            InventoryBusinessLogicEngine.List_ActiveFinanceInvoiceDetails = FinanceInvoiceDetailsList;
            spnAccummulativeAmount.EditValue = FinancialBusinessLogicLibrary.GetTotalNet(FinanceInvoiceDetailsList);
            grdInventoryItems.RefreshDataSource();
            ClearControls();
        }
        private void chkExpenses_CheckedChanged(object sender, EventArgs e)
        {
            txtSerial.Text =
                FinancialBusinessLogicLibrary.GetNextCashBoxInOutTransactionSerial(FinancialBusinessLogicLibrary.SerialType
                                                                                   .CashBoxTransactionInOutExpenses, listToBeViewedOnly);

            //List<>
        }
        private void lkeFloor_EditValueChanged(object sender, EventArgs e)
        {
            if (lkeFloor.EditValue == null)
            {
                return;
            }

            chkIsMan.Enabled = !FinancialBusinessLogicLibrary.IsFloorOfLocationHasMainCashBox(Convert.ToInt32(lkeFloor.EditValue));
        }
Example #4
0
        private void chkLineDiscountType_Toggled(object sender, EventArgs e)
        {
            //if (chkLineDiscountType.IsOn)
            //	Line_DiscountTypeID = (int)DB_DiscountType.Amount;
            //else
            //	Line_DiscountTypeID = (int)DB_DiscountType.Percentage;

            Line_Net = FinancialBusinessLogicLibrary.GetInvoiceCreationLineTotal(Line_PricePerUnit, Line_Quantity,
                                                                                 Line_DiscountAmount, Line_DiscountTypeID);
        }
        public ChooseCashBox_UC()
        {
            InitializeComponent();

            CommonViewsActions.LoadXMLFromString(layoutControl1, Resources.LocalizedRes.lyt_ChooseCashBox);
            CommonViewsActions.SetupGridControl(gridControl1, Resources.LocalizedRes.grd_ChooseCashBox, true);
            CommonViewsActions.SetupSyle(this);

            gridControl1.DataSource =
                FinancialBusinessLogicLibrary.GetOrganizationMachineCashBoxes(ApplicationStaticConfiguration
                                                                              .OrganizationMachine);
        }
 private void SetCashBoxDetails()
 {
     if (ApplicationStaticConfiguration.ActiveCashBox != null)
     {
         txtCashBoxName.Text = ApplicationConfiguration.ApplicationStaticConfiguration.ActiveCashBox
                               .CashBoxFullName;
         DateTime date    = DateTime.Now;
         string   year    = date.Year.ToString();
         string   month   = date.Month.ToString();
         string   day     = date.Day.ToString();
         string   dateStr = "";
         if (Convert.ToInt32(day) >= 1 && Convert.ToInt32(day) <= 9)
         {
             dateStr += "0" + day;
         }
         else
         {
             dateStr += day;
         }
         if (Convert.ToInt32(month) >= 1 && Convert.ToInt32(month) <= 9)
         {
             dateStr += " - 0" + month;
         }
         else
         {
             dateStr += " - " + month;
         }
         dateStr                += " - " + year;
         dtDate.Text             = dateStr;
         spnTotalDebit.EditValue = FinancialBusinessLogicLibrary
                                   .GetCashBoxBalance(ApplicationStaticConfiguration.ActiveCashBox,
                                                      FinancialBusinessLogicLibrary.CashBoxBalanceType.AllDebitOnly).ToString();
         spnTotalCredit.EditValue = FinancialBusinessLogicLibrary
                                    .GetCashBoxBalance(ApplicationStaticConfiguration.ActiveCashBox,
                                                       FinancialBusinessLogicLibrary.CashBoxBalanceType.AllCreditOnly).ToString();
         spnTotalNet.EditValue =
             (FinancialBusinessLogicLibrary.GetCashBoxBalance(ApplicationStaticConfiguration.ActiveCashBox,
                                                              FinancialBusinessLogicLibrary.CashBoxBalanceType.AllDebitOnly) +
              FinancialBusinessLogicLibrary.GetCashBoxBalance(ApplicationStaticConfiguration.ActiveCashBox,
                                                              FinancialBusinessLogicLibrary.CashBoxBalanceType.AllCreditOnly));
     }
     else
     {
         txtCashBoxName.EditValue = 0;
         dtDate.EditValue         = 0;
         spnTotalDebit.EditValue  = 0;
         spnTotalDebit.EditValue  = 0;
         spnTotalNet.EditValue    = 0;
     }
 }
        private void txtStampAmount_EditValueChanged_1(object sender, EventArgs e)
        {
            if (ActiveInvoice == null)
            {
                return;
            }

            if (txtStampAmount.EditValue == null)
            {
                DialogResult result = XtraMessageBox.Show("هل تريد إلغاء الدمغة ؟", "تنبيه", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Error);
                switch (result)
                {
                case DialogResult.Yes:
                    chkIsStampAppliedToInvoice.Checked = false;
                    return;

                case DialogResult.No:
                    result = XtraMessageBox.Show("هل تريد إرجاع الدمغة لقيمة الإعدادت ؟", "تنبيه", MessageBoxButtons.YesNo,
                                                 MessageBoxIcon.Error);
                    switch (result)
                    {
                    case DialogResult.Yes:
                        txtStampAmount.EditValue = ActiveInvoice.InvoiceShareObject.TotalStampAmount =
                            FinancialBusinessLogicLibrary.GetAccummulativeSurchargeAmount((DB_InvoiceType)ActiveInvoice.InvoiceType_P_ID,
                                                                                          DB_SurchargeType.MedicalStamp);
                        return;

                    case DialogResult.No:
                        return;
                    }
                    break;

                case DialogResult.Cancel:
                    return;
                }
            }

            if (ActiveInvoice.IsStampApplied_InvoiceItem)
            {
                ActiveInvoice.InvoiceShareObject.TotalStampAmount = Convert.ToDouble(txtStampAmount.EditValue);
            }
            else
            {
                ActiveInvoice.InvoiceShareObject.TotalStampAmount = null;
            }

            UpdateAllControls(ActiveInvoice);
        }
 public override void ClearControls()
 {
     chkExpenses.Checked = true;
     txtSerial.Text      =
         listToBeViewedOnly != null && listToBeViewedOnly.Count > 0
                                 ? FinancialBusinessLogicLibrary.GetNextCashBoxInOutTransactionSerial(FinancialBusinessLogicLibrary
                                                                                                      .SerialType
                                                                                                      .CashBoxTransactionInOutExpenses, listToBeViewedOnly)
                                 : FinancialBusinessLogicLibrary.GetNextCashBoxInOutTransactionSerial(FinancialBusinessLogicLibrary
                                                                                                      .SerialType
                                                                                                      .CashBoxTransactionInOutExpenses, CashBoxInOutTransaction.ItemsList);
     dtInvoiceCreation.DateTime = DateTime.Now;
     spnAmount.EditValue        = 0;
     txtDescription.Text        = string.Empty;
     spnAmount.SelectAll();
     spnAmount.Focus();
 }
Example #9
0
        private void lkeDedicatedPerson_EditValueChanged(object sender, EventArgs e)
        {
            DB_PriceType   priceType   = DB_PriceType.None;
            DB_InvoiceType invoiceType = (DB_InvoiceType)InvoiceTypeID;

            switch (invoiceType)
            {
            case DB_InvoiceType.SellingInvoice:
            case DB_InvoiceType.ReturningSellingInvoice:
                priceType = DB_PriceType.SellingPrice;
                break;

            case DB_InvoiceType.PurchasingInvoice:
            case DB_InvoiceType.ReturningPurchasingInvoice:
                priceType = DB_PriceType.PurchasingPrice;
                break;
            }
            Line_PricePerUnit = InventoryBusinessLogicEngine.GetInventoryItemSellingPrice(Line_InventoryItem_CU_ID,
                                                                                          Line_UnitMeasurment_CU_ID, InvoiceCreationDate, Person_CU_ID, priceType);
            if (InvoiceTypeID != null)
            {
                switch ((DB_InvoiceType)InvoiceTypeID)
                {
                case DB_InvoiceType.SellingInvoice:
                case DB_InvoiceType.ReturningSellingInvoice:
                    txtDedicatedPersonBalance.EditValue =
                        FinancialBusinessLogicLibrary.GetCustomerBalance(FinancialBusinessLogicLibrary.CustomerBalanceType.NetBalance,
                                                                         InvoiceTypeID, lkeDedicatedPerson.EditValue);
                    break;

                case DB_InvoiceType.PurchasingInvoice:
                case DB_InvoiceType.ReturningPurchasingInvoice:
                    txtDedicatedPersonBalance.EditValue = FinancialBusinessLogicLibrary.GetSupplierBalance(InvoiceTypeID,
                                                                                                           lkeDedicatedPerson.EditValue);
                    break;
                }
            }
        }
        public override void FillControls()
        {
            CommonViewsActions.FillGridlookupEdit(lkeGeneralChartOfAccount, GeneralChartOfAccountType_cu.ItemsList);

            chkExpenses.Checked        = true;
            dtInvoiceCreation.DateTime = DateTime.Now;
            spnAmount.EditValue        = 0;
            txtDescription.Text        = string.Empty;
            txtSerial.Text             =
                listToBeViewedOnly != null && listToBeViewedOnly.Count > 0
                                        ? FinancialBusinessLogicLibrary.GetNextCashBoxInOutTransactionSerial(FinancialBusinessLogicLibrary
                                                                                                             .SerialType
                                                                                                             .CashBoxTransactionInOutExpenses, listToBeViewedOnly)
                                        : FinancialBusinessLogicLibrary.GetNextCashBoxInOutTransactionSerial(FinancialBusinessLogicLibrary
                                                                                                             .SerialType
                                                                                                             .CashBoxTransactionInOutExpenses, CashBoxInOutTransaction.ItemsList);
            if (listToBeViewedOnly != null)
            {
                listToBeViewedOnly.Clear();
                foreach (CashBoxInOutTransaction cashBoxInOutTransaction in CashBoxInOutTransaction.ItemsList)
                {
                    cashBoxInOutTransaction.AddedType = AddedType.AlreadyExists;
                }
                listToBeViewedOnly.AddRange(CashBoxInOutTransaction.ItemsList);
                grdCashBoxInOutTransactions.DataSource = listToBeViewedOnly;
            }

            spnAmount.SelectAll();
            spnAmount.Focus();
            spnAmount.RightToLeft = RightToLeft.No;
            txtCashBoxName.Text   = ApplicationStaticConfiguration.ActiveCashBox.CashBoxFullName;
            txtNet.EditValue      = (FinancialBusinessLogicLibrary.GetCashBoxBalance(
                                         ApplicationStaticConfiguration.ActiveCashBox,
                                         FinancialBusinessLogicLibrary.CashBoxBalanceType.AllDebitOnly) +
                                     FinancialBusinessLogicLibrary.GetCashBoxBalance(
                                         ApplicationStaticConfiguration.ActiveCashBox,
                                         FinancialBusinessLogicLibrary.CashBoxBalanceType.AllCreditOnly));
        }
        public static bool SetInvoicePaymentSerial(InvoicePayment invoicePayment)
        {
            if (invoicePayment == null)
            {
                return(false);
            }

            if (IsInvoicePaymentHasSerial(invoicePayment))
            {
                return(true);
            }

            string nextSerial = FinancialBusinessLogicLibrary.GetNextMedicalInvoiceSerial();

            if (string.IsNullOrEmpty(nextSerial) || string.IsNullOrWhiteSpace(nextSerial))
            {
                return(false);
            }

            invoicePayment.PaymentSerial = nextSerial;

            return(true);
        }
Example #12
0
        private void btnAddToList_Click(object sender, EventArgs e)
        {
            if (Line_InventoryItemAvaliableQuantity == null || Line_InventoryItem_CU_ID == null ||
                Line_UnitMeasurment_CU_ID == null || Line_Quantity == null || Line_PricePerUnit == null)
            {
                return;
            }

            InventoryItem_cu inventoryItem =
                InventoryItem_cu.ItemsList.Find(item => Convert.ToInt32(item.ID).Equals(Convert.ToInt32(Line_InventoryItem_CU_ID)));

            if (inventoryItem == null || inventoryItem.InventoryTrackingUnitMeasurment == null)
            {
                return;
            }

            UnitMeasurment_cu transactionUnitMeasurment =
                UnitMeasurment_cu.ItemsList.Find(item => Convert.ToInt32(item.ID).Equals(Convert.ToInt32(Line_UnitMeasurment_CU_ID)));
            double transactionQuantity = Convert.ToDouble(Line_Quantity);

            if (InventoryBusinessLogicEngine.CanBeAdded((DB_InvoiceType)InvoiceTypeID, inventoryItem, InventoryHousing_CU_ID,
                                                        transactionUnitMeasurment, transactionQuantity))
            {
                FinanceInvoiceDetail financeInvoiceDetail = MerkDBBusinessLogicEngine.CreateNew_FinanceInvoiceDetail(null,
                                                                                                                     Line_InventoryItem_CU_ID, Line_PricePerUnit, Line_UnitMeasurment_CU_ID, Line_Quantity, InvoiceCreationDate,
                                                                                                                     Line_DiscountAmount, Line_DiscountTypeID, Line_Description, Line_IsSurchargeApplied, 0);
                if (financeInvoiceDetail == null)
                {
                    return;
                }

                if (FinanceInvoiceDetailsList == null)
                {
                    FinanceInvoiceDetailsList = new List <FinanceInvoiceDetail>();
                }

                if (InventoryBusinessLogicEngine.List_ActiveFinanceInvoiceDetails == null)
                {
                    InventoryBusinessLogicEngine.List_ActiveFinanceInvoiceDetails = new List <FinanceInvoiceDetail>();
                }
                if (FinanceInvoiceDetailsList.Count == 0)
                {
                    FinanceInvoiceDetailsList.Add(financeInvoiceDetail);
                }
                else
                {
                    if (FinanceInvoiceDetailsList.Exists(
                            item =>
                            Convert.ToInt32(item.InventoryItem_CU_ID).Equals(Convert.ToInt32(financeInvoiceDetail.InventoryItem_CU_ID)) &&
                            Convert.ToInt32(item.UnitMeasurment_CU_ID).Equals(Convert.ToInt32(financeInvoiceDetail.UnitMeasurment_CU_ID))))
                    {
                        DialogResult result =
                            XtraMessageBox.Show("قـد تمـت إضـافتــــه مـن قبــل." + "\r\n\r\n" + "هـل تـريــد إضـافتـــه ؟", "تنبيـــه",
                                                MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1, DefaultBoolean.Default);
                        switch (result)
                        {
                        case DialogResult.Yes:
                            FinanceInvoiceDetailsList.Add(financeInvoiceDetail);
                            break;
                        }
                    }
                    else
                    {
                        FinanceInvoiceDetailsList.Add(financeInvoiceDetail);
                    }
                }
            }
            else
            {
                switch ((DB_InvoiceType)InvoiceTypeID)
                {
                case DB_InvoiceType.SellingInvoice:
                    XtraMessageBox.Show(
                        "لا يمكنـك الإضـافـــة، حيـث أن العــدد أكبــر مـن الحــد الأدنـى للمخــزون" + "\r\n\r\n" + "الحـــد الأدنـــــى : " +
                        inventoryItem.StockMinLevel + " " + inventoryItem.InventoryTrackingUnitMeasurment.Name_P, "تنبيـــه",
                        MessageBoxButtons.OK, MessageBoxIcon.Stop,
                        MessageBoxDefaultButton.Button1, DefaultBoolean.Default);
                    break;

                case DB_InvoiceType.PurchasingInvoice:
                    XtraMessageBox.Show(
                        "لا يمكنـك الإضـافـــة، حيـث أن الكميـــة المضـافــــــة تخطــت الحـــد الأقصـــى للمخـــــزون" + "\r\n\r\n" +
                        "الحـــد الأقصـــى : " + inventoryItem.StockMaxLevel + " " + inventoryItem.InventoryTrackingUnitMeasurment.Name_P,
                        "تنبيـــه", MessageBoxButtons.OK, MessageBoxIcon.Stop, MessageBoxDefaultButton.Button1);
                    break;
                }
            }

            grdInventoryItems.DataSource = FinanceInvoiceDetailsList;
            InventoryBusinessLogicEngine.List_ActiveFinanceInvoiceDetails = FinanceInvoiceDetailsList;
            spnAccummulativeAmount.EditValue =
                spnAmountPaid.EditValue      = FinancialBusinessLogicLibrary.GetTotalNet(FinanceInvoiceDetailsList);

            grdInventoryItems.RefreshDataSource();
            ClearControls();
        }
Example #13
0
 private void spnLineDiscount_EditValueChanged(object sender, EventArgs e)
 {
     Line_Net = FinancialBusinessLogicLibrary.GetInvoiceCreationLineTotal(Line_PricePerUnit, Line_Quantity,
                                                                          Line_DiscountAmount, Line_DiscountTypeID);
 }
 private void chkReverseRevenue_CheckedChanged(object sender, EventArgs e)
 {
     txtSerial.Text =
         FinancialBusinessLogicLibrary.GetNextCashBoxInOutTransactionSerial(FinancialBusinessLogicLibrary.SerialType
                                                                            .CashBoxTransactionInOutDeposit, listToBeViewedOnly);
 }