示例#1
0
        public override void FillControls()
        {
            treeList1.ParentFieldName     = ChartOfAccount_cu.ParentChartOfAccount_CU_ID_ColumnaName;
            treeList1.KeyFieldName        = ChartOfAccount_cu.ID_ColumnaName;
            treeList1.DataSource          = ChartOfAccount_cu.ItemsList;
            ChartOfAccountCodeMargin_P_ID = 1;

            lytParent.Visibility              =
                lytParentCode.Visibility      =
                    lytParentEmpty.Visibility = chkMargin_First.Checked ? LayoutVisibility.Never : LayoutVisibility.Always;

            if (ChartOfAccount_cu.ItemsList.Count == 0)
            {
                chkMargin_Second.Enabled      = false;
                chkMargin_Third.Enabled       = false;
                chkMargin_Fourth.Enabled      = false;
                chkMargin_Fifth.Enabled       = false;
                ChartOfAccountCodeMargin_P_ID = (int)DB_ChartOfAccountCodeMargin.FirstMargin;
            }
            else
            {
                chkMargin_Second.Enabled = true;
                chkMargin_Third.Enabled  = true;
                chkMargin_Fourth.Enabled = true;
                chkMargin_Fifth.Enabled  = true;
            }

            spnSerial.EditValue =
                AccountingBusinessLogicEngine.GetNextChartOfAccountSerial((DB_ChartOfAccountCodeMargin)ChartOfAccountCodeMargin_P_ID,
                                                                          lkeParentChartOfAccount.EditValue);
        }
示例#2
0
        private void chkMargin_First_CheckedChanged(object sender, EventArgs e)
        {
            ChartOfAccountCodeMargin_P_ID     = (int)DB_ChartOfAccountCodeMargin.FirstMargin;
            lytParent.Visibility              = lytParentCode.Visibility = lytParentEmpty.Visibility = LayoutVisibility.Never;
            lkeParentChartOfAccount.EditValue = null;

            CommonViewsActions.FillGridlookupEdit(lkeParentChartOfAccount,
                                                  AccountingBusinessLogicEngine.GetChartOfAccountOfPreviousCodeMargin(ChartOfAccountCodeMargin_P_ID, chkDebit.Checked));

            int allowedNumberOfDigits =
                AccountingBusinessLogicEngine.GetChartOfAccountCodeMarginNumberOfDigits(ChartOfAccountCodeMargin_P_ID);

            spnSerial.Properties.MaxLength = allowedNumberOfDigits;

            lytParent.Visibility              =
                lytParentCode.Visibility      =
                    lytParentEmpty.Visibility = chkMargin_First.Checked ? LayoutVisibility.Never : LayoutVisibility.Always;

            spnSerial.EditValue =
                AccountingBusinessLogicEngine.GetNextChartOfAccountSerial((DB_ChartOfAccountCodeMargin)ChartOfAccountCodeMargin_P_ID,
                                                                          lkeParentChartOfAccount.EditValue);

            //chkCredit.Enabled = true;
            //chkDebit.Enabled = true;
        }
示例#3
0
 private void chkCredit_CheckedChanged(object sender, EventArgs e)
 {
     CommonViewsActions.FillGridlookupEdit(lkeParentChartOfAccount,
                                           AccountingBusinessLogicEngine.GetChartOfAccountOfPreviousCodeMargin(ChartOfAccountCodeMargin_P_ID,
                                                                                                               chkDebit.Checked));
     //if (MerkDBBusinessLogicLibrary.IsDebit(ParentChartOfAccount_CU_ID))
     //{
     //	XtraMessageBox.Show("لا يمكنــك إختيــار دائـــــن، الحســاب الأكبــر طبيعتــه مـديــــن", "تنبيــــه",
     //						MessageBoxButtons.OK, MessageBoxIcon.Hand, MessageBoxDefaultButton.Button1);
     //	chkDebit.Checked = true;
     //}
     //else
     //{
     //	XtraMessageBox.Show("لا يمكنــك إختيــار مـديــــن، الحســاب الأكبــر طبيعتــه دائـــــن", "تنبيــــه",
     //						MessageBoxButtons.OK, MessageBoxIcon.Hand, MessageBoxDefaultButton.Button1);
     //	chkCredit.Checked = true;
     //}
 }
        public override bool ValidateBeforeSave(ref string message)
        {
            if (Name_P == null)
            {
                MessageToView = "يجــب كتابـــة إسـم الحســـاب";
                return(false);
            }

            if (ChartOfAccountCodeMargin_P_ID == null)
            {
                MessageToView = "يجــب إختيـــار مستـــوى الحســـاب";
                return(false);
            }

            if (Serial == null)
            {
                MessageToView = "يجــب كتـابــــة مسلســـل الحســــاب";
                return(false);
            }

            if (Convert.ToInt32(ChartOfAccountCodeMargin_P_ID) != Convert.ToInt32(DB_ChartOfAccountCodeMargin.FirstMargin))
            {
                if (ParentChartOfAccount_CU_ID == null)
                {
                    MessageToView = "يجــب إختيـــار الحســـاب الأكبـــــر";
                    return(false);
                }
            }

            int allowedNumberOfDigits =
                AccountingBusinessLogicEngine.GetChartOfAccountCodeMarginNumberOfDigits(ChartOfAccountCodeMargin_P_ID);

            if (AccountingBusinessLogicEngine.GetChartOfAccountSerial(ParentChartOfAccount_CU_ID, Serial).ToString().Length !=
                allowedNumberOfDigits)
            {
                MessageToView = "يجــب كتـابــــة مسلســـل الحســــاب = " + allowedNumberOfDigits;
                return(false);
            }

            return(true);
        }
示例#5
0
        private void lkeParentChartOfAccount_EditValueChanged(object sender, EventArgs e)
        {
            if (lkeParentChartOfAccount.EditValue == null)
            {
                return;
            }

            long parent = AccountingBusinessLogicEngine.GetChartOfAccountSerial(lkeParentChartOfAccount.EditValue, null);

            spnParentSerial.EditValue = parent;
            chkDebit.Checked          = AccountingBusinessLogicEngine.IsDebit(lkeParentChartOfAccount.EditValue);
            chkCredit.Checked         = !AccountingBusinessLogicEngine.IsDebit(lkeParentChartOfAccount.EditValue);

            spnSerial.EditValue =
                AccountingBusinessLogicEngine.GetNextChartOfAccountSerial((DB_ChartOfAccountCodeMargin)ChartOfAccountCodeMargin_P_ID,
                                                                          lkeParentChartOfAccount.EditValue);
            if (spnSerial.EditValue == string.Empty)
            {
                XtraMessageBox.Show("لا يمكنك الإضافة", "تنبيـــه", MessageBoxButtons.OK, MessageBoxIcon.Hand,
                                    MessageBoxDefaultButton.Button1);
            }
        }
示例#6
0
 private void chkCredit_CheckedChanged(object sender, EventArgs e)
 {
     CommonViewsActions.FillGridlookupEdit(lkeParentChartOfAccount,
                                           AccountingBusinessLogicEngine.GetChartOfAccountOfPreviousCodeMargin(lkeChartOfAccountCodeMargin.EditValue,
                                                                                                               chkDebit.Checked));
 }
        public override bool Collect(AbstractDataCollector <TEntity> collector)
        {
            if (collector == null)
            {
                return(false);
            }

            ActiveCollector = collector;

            ID = ((IChartOfAccountViewer)ActiveCollector.ActiveViewer).ID;

            if (ActiveDBItem == null)
            {
                return(false);
            }

            if (Name_P != null)
            {
                ((ChartOfAccount_cu)ActiveDBItem).Name_P = Name_P.ToString();
            }

            if (Name_S != null)
            {
                ((ChartOfAccount_cu)ActiveDBItem).Name_S = Name_S.ToString();
            }

            if (Description != null)
            {
                ((ChartOfAccount_cu)ActiveDBItem).Description = Description.ToString();
            }

            DB_ChartOfAccountCodeMargin chartOfAccountCodeMargin = DB_ChartOfAccountCodeMargin.None;

            if (ChartOfAccountCodeMargin_P_ID != null)
            {
                ((ChartOfAccount_cu)ActiveDBItem).ChartOfAccountCodeMargin_P_ID = Convert.ToInt32(ChartOfAccountCodeMargin_P_ID);
                chartOfAccountCodeMargin = (DB_ChartOfAccountCodeMargin)Convert.ToInt32(ChartOfAccountCodeMargin_P_ID);
            }

            if (ParentChartOfAccount_CU_ID != null)
            {
                ((ChartOfAccount_cu)ActiveDBItem).ParentChartOfAccount_CU_ID = Convert.ToInt32(ParentChartOfAccount_CU_ID);
            }

            if (Serial != null)
            {
                switch (chartOfAccountCodeMargin)
                {
                case DB_ChartOfAccountCodeMargin.FirstMargin:
                    ((ChartOfAccount_cu)ActiveDBItem).Serial = Convert.ToInt64(Serial);
                    break;

                case DB_ChartOfAccountCodeMargin.SecondMargin:
                case DB_ChartOfAccountCodeMargin.ThirdMargin:
                case DB_ChartOfAccountCodeMargin.FourthMargin:
                case DB_ChartOfAccountCodeMargin.FifthMargin:
                    ((ChartOfAccount_cu)ActiveDBItem).Serial =
                        AccountingBusinessLogicEngine.GetChartOfAccountSerial(ParentChartOfAccount_CU_ID, Serial);
                    break;
                }
            }

            if (IsDebit != null)
            {
                ((ChartOfAccount_cu)ActiveDBItem).IsDebit = Convert.ToBoolean(IsDebit);
            }

            if (UserID != null)
            {
                ((ChartOfAccount_cu)ActiveDBItem).InsertedBy = Convert.ToInt32(UserID);
            }

            ((ChartOfAccount_cu)ActiveDBItem).IsOnDuty = true;
            switch (((IChartOfAccountViewer)ActiveCollector.ActiveViewer).CommonTransactionType)
            {
            case DB_CommonTransactionType.DeleteExisting:
                ((ChartOfAccount_cu)ActiveDBItem).IsOnDuty = false;
                break;
            }

            RelatedViewers = ((IChartOfAccountViewer)ActiveCollector.ActiveViewer).RelatedViewers;

            return(true);
        }