/// <summary>
        /// Document Base type for Process e.g. POO for Purchase Order
        /// </summary>
        /// <param name="docBaseType"></param>
        private void ProcessDocBaseType(string docBaseType)
        {
            int      M_Product_ID = 0;
            DateTime?sDate        = null;
            DateTime?eDate        = null;

            if (VAdvantage.Model.MDocBaseType.DOCBASETYPE_PURCHASEORDER.Equals(docBaseType))
            {
                VAdvantage.Model.MOrder ord = new VAdvantage.Model.MOrder(GetCtx(), _Record_ID, _trx);
                if (controlBasis.Equals("A"))
                {
                    sql.Clear();
                    sql.Append(@" SELECT PeriodNo, StartDate , EndDate FROM C_Period WHERE C_Year_ID = (SELECT cy.C_Year_ID FROM C_Period cp inner join  C_Year cy
     ON (cy.c_year_id = cp.c_Year_id) WHERE cy.IsActive = 'Y' AND cy.AD_Client_ID = " + _AD_Client_ID + @" AND StartDate   <= " + GlobalVariable.TO_DATE(ord.GetDateOrdered(), true) + @"
  AND EndDate     >= " + GlobalVariable.TO_DATE(ord.GetDateOrdered(), true) + @"
  AND cy.c_calendar_id = (SELECT C_Calendar_ID FROM AD_ClientInfo WHERE ad_clientinfo.ad_client_id = " + _AD_Client_ID + @")) AND PeriodNo IN (1,12)");
                    // sql.Append("SELECT  PeriodNo, StartDate, EndDate FROM C_Period WHERE C_Year_ID = (SELECT C_Year_ID FROM C_Period WHERE IsActive = 'Y' AND AD_Client_ID = " + _AD_Client_ID + " AND StartDate <= " + GlobalVariable.TO_DATE(System.DateTime.Now, false) + " AND EndDate >= " + GlobalVariable.TO_DATE(System.DateTime.Now, false) + ") AND PeriodNo IN (1,12)");
                    DataSet dsPer = DB.ExecuteDataset(sql.ToString(), null, null);
                    if (dsPer != null)
                    {
                        if (dsPer.Tables[0].Rows.Count > 0)
                        {
                            for (int k = 0; k < dsPer.Tables[0].Rows.Count; k++)
                            {
                                if (Util.GetValueOfInt(dsPer.Tables[0].Rows[k]["PeriodNo"]).Equals(1))
                                {
                                    sDate = Util.GetValueOfDateTime(dsPer.Tables[0].Rows[k]["StartDate"]);
                                }
                                if (Util.GetValueOfInt(dsPer.Tables[0].Rows[k]["PeriodNo"]).Equals(12))
                                {
                                    eDate = Util.GetValueOfDateTime(dsPer.Tables[0].Rows[k]["EndDate"]);
                                }
                            }
                        }
                    }
                    else
                    {
                        log.SaveError("Period Not Found", "Period Not Found");
                    }
                    dsPer.Dispose();
                    //whereClause.Append(" AND DateAcct >= " + GlobalVariable.TO_DATE(sDate, false) + " AND DateAcct <= " + GlobalVariable.TO_DATE(eDate, false));
                }
                else if (controlBasis.Equals("P"))
                {
                    sql.Clear();
                    sql.Append(@" SELECT PeriodNo, StartDate , EndDate FROM C_Period cp INNER JOIN C_Year cy ON (cy.c_year_id = cp.c_Year_id) WHERE cy.IsActive = 'Y'
AND cy.AD_Client_ID = " + _AD_Client_ID + @" AND StartDate   <= " + GlobalVariable.TO_DATE(ord.GetDateOrdered(), true) + @"
AND EndDate     >= " + GlobalVariable.TO_DATE(ord.GetDateOrdered(), true) + @" AND cy.c_calendar_id  = (SELECT C_Calendar_ID FROM AD_ClientInfo
      WHERE ad_clientinfo.ad_client_id = " + _AD_Client_ID + @")");

                    //sql.Append("SELECT  PeriodNo, StartDate, EndDate FROM C_Period WHERE IsActive = 'Y' AND AD_Client_ID = " + _AD_Client_ID + " AND StartDate <= " + GlobalVariable.TO_DATE(System.DateTime.Now, false) + " AND EndDate >= " + GlobalVariable.TO_DATE(System.DateTime.Now, false));
                    DataSet dsPer = DB.ExecuteDataset(sql.ToString(), null, null);
                    if (dsPer != null)
                    {
                        if (dsPer.Tables[0].Rows.Count > 0)
                        {
                            sDate = Util.GetValueOfDateTime(dsPer.Tables[0].Rows[0]["StartDate"]);
                            eDate = Util.GetValueOfDateTime(dsPer.Tables[0].Rows[0]["EndDate"]);
                        }
                    }
                    else
                    {
                        log.SaveError("Period Not Found", "Period Not Found");
                    }
                    dsPer.Dispose();
                }
                sql.Clear();
                sql.Append("SELECT * FROM C_OrderLine WHERE C_Order_ID = " + _Record_ID + " AND IsActive ='Y'");
                DataSet ds = DB.ExecuteDataset(sql.ToString(), null, null);
                if (ds != null)
                {
                    for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                    {
                        whereClause.Clear();

                        // Amount = 0;

                        VAdvantage.Model.MOrderLine ol = new VAdvantage.Model.MOrderLine(GetCtx(), Util.GetValueOfInt(ds.Tables[0].Rows[i]["C_OrderLine_ID"]), _trx);
                        M_Product_ID = ol.GetM_Product_ID();
                        int Account_ID = 0;
                        if (M_Product_ID > 0)
                        {
                            Account_ID = GetAccount(M_Product_ID, 0);
                            whereClause.Append(" WHERE fa.AD_Client_ID = " + _AD_Client_ID + " AND fa.Account_ID = " + Account_ID + " AND fa.AD_Org_ID = " + _AD_Org_ID);
                        }
                        else if (ol.GetC_Charge_ID() > 0)
                        {
                            Account_ID = GetAccount(0, ol.GetC_Charge_ID());
                            whereClause.Append(" WHERE fa.AD_Client_ID = " + _AD_Client_ID + " AND fa.Account_ID = " + Account_ID + " AND fa.AD_Org_ID = " + _AD_Org_ID);
                        }
                        whereClause.Append(" AND fa.DateAcct >= " + GlobalVariable.TO_DATE(sDate, false) + " AND fa.DateAcct <= " + GlobalVariable.TO_DATE(eDate, false));
                        //  GetBudgetAgainstDimension(ord);

                        if (Account_ID > 0)
                        {
                            Decimal?lineAmount = GetLineAmount(ord.GetC_Currency_ID(), ol.GetLineNetAmt());
                            int     BudgetID   = 0;
                            //if (ord.GetC_Project_ID() > 0)
                            //{
                            //    BudgetID = GetProjectBudget(ord.GetC_Project_ID());
                            //}
                            //if (BudgetID <= 0)
                            //{
                            //    BudgetID = GetOrgBudget();
                            //}

                            BudgetID = GetBudgetAmount(Account_ID, sDate, eDate, ord);
                            if (BudgetID > 0)
                            {
                                GetBudgetControlComparison(BudgetID);
                                Decimal?amt = CompareBudget(lineAmount, ord);
                                sql.Clear();
                                if (amt > 0)
                                {
                                    ol.SetBudgetViolationAmount(amt);
                                    if (!ol.Save())
                                    {
                                    }
                                    //sql.Append("UPDATE C_OrderLine SET BudgetViolationAmount = " + amt + " WHERE C_OrderLine_ID = " + Util.GetValueOfInt(ds.Tables[0].Rows[i]["C_OrderLine_ID"]));
                                    //int res = Util.GetValueOfInt(DB.ExecuteQuery(sql.ToString(), null, null));
                                }
                            }
                            else
                            {
                                log.SaveError("Budget Not Found", "Budget Not Found");
                            }
                        }
                        else
                        {
                            log.SaveError("No Account Found", "No Account Found");
                        }
                        //  bool chk = ol.Save(_trxName);
                    }
                }
                else
                {
                    log.SaveError("No OrderLines Found", "No OrderLines Found");
                }
            }
            #region
            else if (VAdvantage.Model.MDocBaseType.DOCBASETYPE_SALESORDER.Equals(docBaseType))
            {
            }
            else if (VAdvantage.Model.MDocBaseType.DOCBASETYPE_APCREDITMEMO.Equals(docBaseType))
            {
            }
            else if (VAdvantage.Model.MDocBaseType.DOCBASETYPE_APINVOICE.Equals(docBaseType))
            {
            }
            else if (VAdvantage.Model.MDocBaseType.DOCBASETYPE_APPAYMENT.Equals(docBaseType))
            {
            }
            else if (VAdvantage.Model.MDocBaseType.DOCBASETYPE_ARCREDITMEMO.Equals(docBaseType))
            {
            }
            else if (VAdvantage.Model.MDocBaseType.DOCBASETYPE_ARINVOICE.Equals(docBaseType))
            {
            }
            else if (VAdvantage.Model.MDocBaseType.DOCBASETYPE_ARPROFORMAINVOICE.Equals(docBaseType))
            {
            }
            else if (VAdvantage.Model.MDocBaseType.DOCBASETYPE_ARRECEIPT.Equals(docBaseType))
            {
            }
            else if (VAdvantage.Model.MDocBaseType.DOCBASETYPE_BANKSTATEMENT.Equals(docBaseType))
            {
            }
            else if (VAdvantage.Model.MDocBaseType.DOCBASETYPE_CASHJOURNAL.Equals(docBaseType))
            {
            }
            else if (VAdvantage.Model.MDocBaseType.DOCBASETYPE_FIXASSET.Equals(docBaseType))
            {
            }
            else if (VAdvantage.Model.MDocBaseType.DOCBASETYPE_GLDOCUMENT.Equals(docBaseType))
            {
            }
            else if (VAdvantage.Model.MDocBaseType.DOCBASETYPE_GLJOURNAL.Equals(docBaseType))
            {
            }
            else if (VAdvantage.Model.MDocBaseType.DOCBASETYPE_MATCHINVOICE.Equals(docBaseType))
            {
            }
            else if (VAdvantage.Model.MDocBaseType.DOCBASETYPE_MATCHPO.Equals(docBaseType))
            {
            }
            else if (VAdvantage.Model.MDocBaseType.DOCBASETYPE_MATERIALDELIVERY.Equals(docBaseType))
            {
            }
            else if (VAdvantage.Model.MDocBaseType.DOCBASETYPE_MATERIALMOVEMENT.Equals(docBaseType))
            {
            }
            else if (VAdvantage.Model.MDocBaseType.DOCBASETYPE_MATERIALPHYSICALINVENTORY.Equals(docBaseType))
            {
            }
            else if (VAdvantage.Model.MDocBaseType.DOCBASETYPE_MATERIALPICK.Equals(docBaseType))
            {
            }
            else if (VAdvantage.Model.MDocBaseType.DOCBASETYPE_MATERIALPRODUCTION.Equals(docBaseType))
            {
            }
            else if (VAdvantage.Model.MDocBaseType.DOCBASETYPE_MATERIALPUTAWAY.Equals(docBaseType))
            {
            }
            else if (VAdvantage.Model.MDocBaseType.DOCBASETYPE_MATERIALRECEIPT.Equals(docBaseType))
            {
            }
            else if (VAdvantage.Model.MDocBaseType.DOCBASETYPE_MATERIALREPLENISHMENT.Equals(docBaseType))
            {
            }
            else if (VAdvantage.Model.MDocBaseType.DOCBASETYPE_PAYMENTALLOCATION.Equals(docBaseType))
            {
            }
            else if (VAdvantage.Model.MDocBaseType.DOCBASETYPE_PROJECTISSUE.Equals(docBaseType))
            {
            }
            else if (VAdvantage.Model.MDocBaseType.DOCBASETYPE_PURCHASEREQUISITION.Equals(docBaseType))
            {
            }
            else if (VAdvantage.Model.MDocBaseType.DOCBASETYPE_STANDARDCOSTUPDATE.Equals(docBaseType))
            {
            }
            else if (VAdvantage.Model.MDocBaseType.DOCBASETYPE_WORKORDER.Equals(docBaseType))
            {
            }
            else if (VAdvantage.Model.MDocBaseType.DOCBASETYPE_WORKORDERTRANSACTION.Equals(docBaseType))
            {
            }
            #endregion
        }