Exemple #1
0
        protected void btnUpdate_Click(object sender, EventArgs e)
        {
            try
            {
                Acc_COA dupitem = _COA.Find(p => p.COAName == txtAhead.Text.Trim() && p.ParentKey == _SelectedCOAKey && p.COAKey != _SelectedCOAKey);
                if (dupitem != null)
                {
                    ((Hr.Web.UI.ACC.COA) this.Page).ErrorMessage = "Duplicate Head Name could not be created.";
                    return;
                }

                Acc_COA selectedNode = _COA.Find(p => p.COAKey == _SelectedCOAKey);
                if (selectedNode != null)
                {
                    selectedNode.COAName      = txtAhead.Text.Trim();
                    selectedNode.IsActive     = chkActive.Checked;
                    selectedNode.IsSubsidiary = chkIsSubsidiary.Checked;
                    if (SaveCOA())
                    {
                        ((Hr.Web.UI.ACC.COA) this.Page).SuccessMessage = StaticInfo.UpdatedSuccessfullyMsg;
                    }
                    ;
                }
            }
            catch (Exception ex)
            {
                ((Hr.Web.UI.ACC.COA) this.Page).ErrorMessage = ex.Message;
            }
        }
Exemple #2
0
 protected void btnDelete_Click(object sender, EventArgs e)
 {
     try
     {
         Acc_COA selectedNode = _COA.Find(p => p.COAKey == _SelectedCOAKey);
         if (selectedNode != null)
         {
             //selectedNode.COAKey
             Acc_VoucherDet obj = null;
             if (selectedNode.IsSubsidiary)
             {
                 obj = Acc_VoucherDet.CheckToDelete(selectedNode.COAKey);
             }
             if (obj.IsAdded)
             {
                 selectedNode.Delete();
                 if (SaveCOA())
                 {
                     ((Hr.Web.UI.ACC.COA) this.Page).SuccessMessage = StaticInfo.DeletedSuccessfullyMsg;
                 }
             }
             else
             {
                 ((Hr.Web.UI.ACC.COA) this.Page).ErrorMessage = "Transaction has been occured to this head!";
             }
         }
     }
     catch (Exception ex)
     {
         ((Hr.Web.UI.ACC.COA) this.Page).ErrorMessage = ex.Message;
     }
 }
        public int FillChild(Acc_COA parent, Int64 coaKey)
        {
            CustomList <Acc_COA> list = AccCOAList.FindAll(p => p.ParentKey == coaKey);

            if (list.Count > 0)
            {
                foreach (Acc_COA item in list)
                {
                    Acc_COA atom = new Acc_COA();
                    atom.COAKey        = item.COAKey;
                    atom.COALevel      = item.COALevel;
                    atom.COAName       = item.COAName.PadLeft(item.COAName.Length + ((item.COALevel - 1) * 5), '-');
                    atom.ParentKey     = item.ParentKey;
                    atom.COACode       = item.COACode;
                    atom.COACodeClient = item.COACodeClient;
                    atom.IsActive      = item.IsActive;
                    atom.IsPostingHead = item.IsPostingHead;
                    lst.Add(atom);
                    FillChild(atom, item.COAKey);
                }
                return(0);
            }
            else
            {
                return(0);
            }
        }
Exemple #4
0
 public static string AddNewBankAccoount(string bankName, string bankAccount, decimal?depositAmmount)
 {
     using (AprosysAccountingEntities db = new AprosysAccountingEntities())
     {
         try
         {
             var chk = db.Acc_COA.FirstOrDefault(x => x.TreeName == bankAccount);
             if (chk != null)
             {
                 return(String.Format("Account No: {0} is already exist.", bankAccount));
             }
             var acc = new Acc_COA();
             acc.PId            = 104;
             acc.CoaNo          = "";
             acc.HeadAccount    = 1;
             acc.TreeName       = bankAccount;
             acc.CoaLevel       = 2;
             acc.OpeningBalance = depositAmmount;
             acc.IsActive       = true;
             db.Acc_COA.Add(acc);
             db.SaveChanges();
             return("success");
         }
         catch (Exception ex) { throw ex; }
     }
 }
Exemple #5
0
        protected void btnCreate_Click(object sender, EventArgs e)
        {
            try
            {
                if (txtCHead.Text.IsNullOrEmpty())
                {
                    ((API.UI.ACC.COA) this.Page).ErrorMessage = "Please provide Head Name.";
                    return;
                }

                Acc_COA dupitem = _COA.Find(p => p.COAName == txtCHead.Text.Trim() && p.ParentKey == _SelectedCOAKey);
                if (dupitem != null)
                {
                    ((API.UI.ACC.COA) this.Page).ErrorMessage = "Duplicate Head Name could not be created.";
                    return;
                }

                Acc_COA selectedItem = _COA.Find(p => p.COAKey == _SelectedCOAKey);
                if (selectedItem != null)
                {
                    Acc_COA newItem = new Acc_COA();

                    newItem.COALevel  = selectedItem.COALevel + 1;
                    newItem.COAName   = txtCHead.Text.Trim();
                    newItem.IsActive  = chkActive.Checked;
                    newItem.ParentKey = _SelectedCOAKey;
                    newItem.COAKey    = _COA.Count + Int32.MinValue;

                    if (ddlFromCostCentre.SelectedValue.ToString() == "")
                    {
                        newItem.CostCenterID = null;
                    }
                    else
                    {
                        newItem.CostCenterID = ddlFromCostCentre.SelectedValue.ToInt();
                    }

                    newItem.IsDefaultCash = chkIsDefaultCash.Checked;
                    newItem.IsCash        = chkIsCash.Checked;

                    newItem.IsPostingHead = chkPostingHea.Checked;

                    //((ST.Web.Hr.Initialization.Setup.COA)this.Page).CurrentUserSession.UserCode;

                    _COA.Add(newItem);

                    if (SaveCOA())
                    {
                        ((API.UI.ACC.COA) this.Page).SuccessMessage = StaticInfo.SavedSuccessfullyMsg;
                    }
                }
            }
            catch (Exception ex)
            {
                ((API.UI.ACC.COA) this.Page).ErrorMessage = ex.Message;
            }
        }
        private void InitializeSession()
        {
            try
            {
                GRID_COA = new CustomList <Acc_COA>();
                GRID_COA = Acc_COA.GetAllAcc_COA();
                AccReportConfigurationHeadList       = new CustomList <AccReportConfigurationHead>();
                AccReportConfigurationHeadCOAMapList = new CustomList <AccReportConfigurationHeadCOAMap>();
            }

            catch (Exception ex)
            {
                throw (ex);
            }
        }
Exemple #7
0
        protected void tv_SelectedNodeChanged(object sender, EventArgs e)
        {
            try
            {
                btnUpdate.Enabled = true;
                btnDelete.Enabled = true;
                btnCreate.Enabled = true;

                TreeNode node = tv.SelectedNode;
                _selnode = node;
                if (node == null)
                {
                    return;
                }

                string value = node.Value;
                if (value.IsNullOrEmpty())
                {
                    return;
                }

                //setting node info
                Acc_COA selectedNode = _COA.Find(p => p.COAKey == Convert.ToInt64(value));
                if (selectedNode == null)
                {
                    return;
                }

                txtAcLevel.Text          = selectedNode.COALevel.ToString();
                txtAhead.Text            = selectedNode.COAName;
                chkActive.Checked        = selectedNode.IsActive;
                chkPostingHea.Checked    = selectedNode.IsPostingHead;
                txtAcCode.Text           = selectedNode.COACode;
                _SelectedCOAKey          = selectedNode.COAKey;
                chkIsDefaultCash.Checked = selectedNode.IsDefaultCash;
                chkIsCash.Checked        = selectedNode.IsCash;
                if (selectedNode.CostCenterID != 0)
                {
                    ddlFromCostCentre.SelectedValue = selectedNode.CostCenterID.ToString();
                }

                validateState(node);
            }
            catch (Exception ex)
            {
                ((API.UI.ACC.COA) this.Page).ErrorMessage = (ExceptionHelper.getExceptionMessage(ex));
            }
        }
Exemple #8
0
        protected void btnCreate_Click(object sender, EventArgs e)
        {
            try
            {
                if (txtCHead.Text.IsNullOrEmpty())
                {
                    ((Hr.Web.UI.ACC.COA) this.Page).ErrorMessage = "Please provide Head Name.";
                    return;
                }

                Acc_COA dupitem = _COA.Find(p => p.COAName == txtCHead.Text.Trim() && p.ParentKey == _SelectedCOAKey);
                if (dupitem != null)
                {
                    ((Hr.Web.UI.ACC.COA) this.Page).ErrorMessage = "Duplicate Head Name could not be created.";
                    return;
                }

                Acc_COA selectedItem = _COA.Find(p => p.COAKey == _SelectedCOAKey);
                if (selectedItem != null)
                {
                    Acc_COA newItem = new Acc_COA();

                    newItem.COALevel     = selectedItem.COALevel + 1;
                    newItem.COAName      = txtCHead.Text.Trim();
                    newItem.IsActive     = chkActive.Checked;
                    newItem.IsSubsidiary = chkIsSubsidiary.Checked;
                    newItem.ParentKey    = _SelectedCOAKey;
                    newItem.COAKey       = _COA.Count + Int32.MinValue;

                    newItem.IsPostingHead = false;
                    newItem.EntryDate     = DateTime.Now;
                    newItem.EntryUserKey  = (Int64)1;

                    //((ST.Web.Hr.Initialization.Setup.COA)this.Page).CurrentUserSession.UserCode;

                    _COA.Add(newItem);

                    if (SaveCOA())
                    {
                        ((Hr.Web.UI.ACC.COA) this.Page).SuccessMessage = StaticInfo.SavedSuccessfullyMsg;
                    }
                }
            }
            catch (Exception ex)
            {
                ((Hr.Web.UI.ACC.COA) this.Page).ErrorMessage = ex.Message;
            }
        }
Exemple #9
0
        protected void tv_SelectedNodeChanged(object sender, EventArgs e)
        {
            try
            {
                btnUpdate.Enabled = true;
                btnDelete.Enabled = true;
                btnCreate.Enabled = true;

                TreeNode node = tv.SelectedNode;
                _selnode = node;
                if (node == null)
                {
                    return;
                }

                string value = node.Value;
                if (value.IsNullOrEmpty())
                {
                    return;
                }

                //setting node info
                Acc_COA selectedNode = _COA.Find(p => p.COAKey == Convert.ToInt64(value));
                if (selectedNode == null)
                {
                    return;
                }

                txtAcLevel.Text         = selectedNode.COALevel.ToString();
                txtAhead.Text           = selectedNode.COAName;
                chkActive.Checked       = selectedNode.IsActive;
                chkIsSubsidiary.Checked = selectedNode.IsSubsidiary;
                txtAcCode.Text          = selectedNode.COACode;
                _SelectedCOAKey         = selectedNode.COAKey;
                if (selectedNode.IsSubsidiary)
                {
                    btnCreate.Enabled = false;
                }
                validateState(node);
            }
            catch (Exception ex)
            {
                ((Hr.Web.UI.ACC.COA) this.Page).ErrorMessage = (ExceptionHelper.getExceptionMessage(ex));
            }
        }
Exemple #10
0
        protected void btnUpdate_Click(object sender, EventArgs e)
        {
            try
            {
                Acc_COA dupitem = _COA.Find(p => p.COAName == txtAhead.Text.Trim() && p.ParentKey == _SelectedCOAKey && p.COAKey != _SelectedCOAKey);
                if (dupitem != null)
                {
                    ((API.UI.ACC.COA) this.Page).ErrorMessage = "Duplicate Head Name could not be created.";
                    return;
                }

                Acc_COA selectedNode = _COA.Find(p => p.COAKey == _SelectedCOAKey);
                if (selectedNode != null)
                {
                    selectedNode.COAName       = txtAhead.Text.Trim();
                    selectedNode.IsActive      = chkActive.Checked;
                    selectedNode.IsPostingHead = chkPostingHea.Checked;

                    if (ddlFromCostCentre.SelectedValue.ToString() == "")
                    {
                        selectedNode.CostCenterID = null;
                    }
                    else
                    {
                        selectedNode.CostCenterID = ddlFromCostCentre.SelectedValue.ToInt();
                    }

                    selectedNode.IsDefaultCash = chkIsDefaultCash.Checked;
                    selectedNode.IsCash        = chkIsCash.Checked;

                    if (SaveCOA())
                    {
                        ((API.UI.ACC.COA) this.Page).SuccessMessage = StaticInfo.UpdatedSuccessfullyMsg;
                    }
                    ;
                }
            }
            catch (Exception ex)
            {
                ((API.UI.ACC.COA) this.Page).ErrorMessage = ex.Message;
            }
        }
Exemple #11
0
 protected void btnDelete_Click(object sender, EventArgs e)
 {
     try
     {
         Acc_COA selectedNode = _COA.Find(p => p.COAKey == _SelectedCOAKey);
         if (selectedNode != null)
         {
             selectedNode.Delete();
             if (SaveCOA())
             {
                 ((API.UI.ACC.COA) this.Page).SuccessMessage = StaticInfo.DeletedSuccessfullyMsg;
             }
             ;
         }
     }
     catch (Exception ex)
     {
         ((API.UI.ACC.COA) this.Page).ErrorMessage = ex.Message;
     }
 }
 private void formatCOA()
 {
     lst.Clear();
     foreach (Acc_COA item in AccCOAList)
     {
         if (item.ParentKey == null)
         {
             Acc_COA atom = new Acc_COA();
             atom.COAKey        = item.COAKey;
             atom.COALevel      = item.COALevel;
             atom.COAName       = item.COAName;
             atom.ParentKey     = item.ParentKey;
             atom.COACode       = item.COACode;
             atom.COACodeClient = item.COACodeClient;
             atom.IsActive      = item.IsActive;
             atom.IsPostingHead = item.IsPostingHead;
             lst.Add(atom);
             FillChild(atom, item.COAKey);
         }
     }
 }
Exemple #13
0
 public CustomList <Acc_COA> GetAllAcc_COA_CashInHand()
 {
     return(Acc_COA.GetAllAcc_COA_CashInHand());
 }
Exemple #14
0
 public CustomList <Acc_COA> GetAllAcc_COA_ByLevelAll(int isSubsidiary, int voucherType)
 {
     return(Acc_COA.GetAllAcc_COA_ByLevelAll(isSubsidiary, voucherType));
 }
Exemple #15
0
 public CustomList <Acc_COA> GetAllAcc_COAGetReceivable()
 {
     return(Acc_COA.GetAllAcc_COAGetReceivable());
 }
Exemple #16
0
 public CustomList <Acc_COA> GetAllAcc_COA_ByLevel(int isSubsidiary)
 {
     return(Acc_COA.GetAllAcc_COA_ByLevel(isSubsidiary));
 }
Exemple #17
0
 public CustomList <Acc_COA> GetAllCashOrBankCOA(String menuName)
 {
     return(Acc_COA.GetAllCashOrBankCOA(menuName));
 }
Exemple #18
0
 public CustomList <Acc_COA> GetAllAcc_COA_ByLevel(int level)
 {
     return(Acc_COA.GetAllAcc_COA_ByLevel(level));
 }
 private void loadCOA()
 {
     _COA = Acc_COA.GetAllAcc_COA(true);
 }
Exemple #20
0
 public CustomList <Acc_COA> GetAllAcc_COA_CashAtBank()
 {
     return(Acc_COA.GetAllAcc_COA_CashAtBank());
 }
Exemple #21
0
 public CustomList <Acc_COA> GetAllAcc_COA()
 {
     return(Acc_COA.GetAllAcc_COA());
 }
Exemple #22
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (IsPostBack.IsFalse())
     {
         String match = HttpContext.Current.Request.QueryString["Match"];
         if (match == "editVoucher")
         {
             //InitializeCombo();
             //InitializeSession();
             //String vocherNo = HttpContext.Current.Request.QueryString["VoucherNo"];
             //Acc_Voucher item = manager.GetAllAcc_Voucher(vocherNo);
             //CustomList<Acc_Voucher> VoucherList = new CustomList<Acc_Voucher>();
             //VoucherList.Add(item);
             //AccVoucherList = VoucherList;
             //PopulatePFVoucherInformation(item);
         }
         else
         {
             hfCOAKey.Value = "";
             InitializeCombo();
             btnNew_Click(null, null);
             ddlCurrencyID.SelectedValue = "1";
             workflow.Visible            = false;
         }
     }
     else
     {
         Page.ClientScript.GetPostBackEventReference(this, String.Empty);
         String eventTarget = Request["__EVENTTARGET"].IsNullOrEmpty() ? String.Empty : Request["__EVENTTARGET"];
         if (eventTarget == "SearchVoucher")
         {
             Acc_Voucher searchAccVoucher         = Session[STATIC.StaticInfo.SearchSessionVarName] as Acc_Voucher;
             CustomList <Acc_Voucher> VoucherList = new CustomList <Acc_Voucher>();
             VoucherList.Add(searchAccVoucher);
             AccVoucherList = VoucherList;
             if (searchAccVoucher.IsNotNull())
             {
                 PopulatePFVoucherInformation(searchAccVoucher);
             }
         }
         else if (eventTarget == "vou_delete")
         {
             btnDelete_Click(null, null);
         }
         else if (eventTarget == "SearchCOA")
         {
             Acc_COA searchCOA = Session[STATIC.StaticInfo.SearchSessionVarName] as Acc_COA;
             txtHeadCode.Text = searchCOA.COACode;
             txtHeadName.Text = searchCOA.COAName;
             hfCOAKey.Value   = searchCOA.COAKey.ToString();
         }
         else if (eventTarget == "Test")
         {
             String      eventArgu                = Request["__EVENTARGUMENT"].IsNullOrEmpty() ? String.Empty : Request["__EVENTARGUMENT"];
             Acc_Voucher searchAccVoucher         = manager.GetAllAcc_WorkFlowVoucher(eventArgu);//Session[STATIC.StaticInfo.SearchSessionVarName] as Acc_Voucher;
             CustomList <Acc_Voucher> VoucherList = new CustomList <Acc_Voucher>();
             VoucherList.Add(searchAccVoucher);
             AccVoucherList = VoucherList;
             if (searchAccVoucher.IsNotNull())
             {
                 PopulatePFVoucherInformation(searchAccVoucher);
             }
             common.Visible   = false;
             workflow.Visible = true;
         }
     }
 }