public void LoadList()
 {
     foreach (DataRow drAccountBudget in AccountBudget.GetDSG(ddlDivision.SelectedValue.ToString(), Convert.ToInt16(ddlFiscalYear.SelectedValue)).Rows)
     {
         Response.Write("<tr>");
         Response.Write("<td class='GridRows'><a href='AccountBudgetDivisionViewer.aspx?rccode=" + drAccountBudget["rccode"] + "'>" + drAccountBudget["rccode"] + "</td>");
         Response.Write("<td class='GridRows'>" + drAccountBudget["rcname"] + "</td>");
         if (Convert.ToDouble(drAccountBudget["bud_value"]) < 0)
         {
             Response.Write("<td class='GridRows' style='text-align:right;'>(" + (Convert.ToDouble(drAccountBudget["bud_value"]) * -1).ToString("###,##0.00") + ")</td>");
         }
         else
         {
             Response.Write("<td class='GridRows' style='text-align:right;'>" + Convert.ToDouble(drAccountBudget["bud_value"]).ToString("###,##0.00") + "</td>");
         }
         if (Convert.ToDouble(drAccountBudget["availed_value"]) < 0)
         {
             Response.Write("<td class='GridRows' style='text-align:right;'>(" + (Convert.ToDouble(drAccountBudget["availed_value"]) * -1).ToString("###,##0.00") + ")</td>");
         }
         else
         {
             Response.Write("<td class='GridRows' style='text-align:right;'>" + Convert.ToDouble(drAccountBudget["availed_value"]).ToString("###,##0.00") + "</td>");
         }
         if ((Convert.ToDouble(drAccountBudget["bud_value"]) - Convert.ToDouble(drAccountBudget["availed_value"])) < 0)
         {
             Response.Write("<td class='GridRows' style='text-align:right;'>(" + ((Convert.ToDouble(drAccountBudget["bud_value"]) - Convert.ToDouble(drAccountBudget["availed_value"])) * -1).ToString("###,##0.00") + ")</td>");
         }
         else
         {
             Response.Write("<td class='GridRows' style='text-align:right;'>" + (Convert.ToDouble(drAccountBudget["bud_value"]) - Convert.ToDouble(drAccountBudget["availed_value"])).ToString("###,##0.00") + "</td>");
         }
         Response.Write("</tr>");
     }
 }
    public void LoadGrid()
    {
        string strWrite           = "";
        int    intCounter         = 0;
        double dblAmountPossitive = 0;
        double dblAmountNegative  = 0;

        foreach (DataRow drBudgetItem in AccountBudget.GetDSGforAdjustmentBudget(Request.QueryString["rccode"], Convert.ToInt16(ddlFiscalYear.SelectedValue), Request.QueryString["accnt_items_code"].ToString()).Rows)
        {
            intCounter += 1;
            strWrite   += "<tr>";
            strWrite   += "<td class='GridRows'>" + intCounter.ToString() + "</td>";
            strWrite   += "<td class='GridRows'>" + drBudgetItem["created_on"].ToString() + "</td>";
            strWrite   += "<td class='GridRows'>" + drBudgetItem["accnt_bud_cat_name"].ToString() + "</td>";
            strWrite   += "<td class='GridRows'>" + drBudgetItem["remarks"].ToString() + "</td>";
            if (drBudgetItem["accnt_bud_cat_code"].ToString() == "04")
            {
                strWrite          += "<td class='GridRows' style='text-align:right;'>(" + Convert.ToDouble(drBudgetItem["bud_value"]).ToString("###,##0.00") + ")</td>";
                dblAmountNegative += Convert.ToDouble(drBudgetItem["bud_value"]);
            }
            else
            {
                strWrite           += "<td class='GridRows' style='text-align:right;'>" + Convert.ToDouble(drBudgetItem["bud_value"]).ToString("###,##0.00") + "</td>";
                dblAmountPossitive += Convert.ToDouble(drBudgetItem["bud_value"]);
            }
            strWrite += "</tr>";
        }
        strWrite     += "<tr><td colspan='4' class='GridRows' style='text-align:right;'>Total</td><td class='GridRows' style='text-align:right;'>" + (dblAmountPossitive - dblAmountNegative).ToString("###,##0.00") + "</td></tr>";
        lblItems.Text = strWrite;
    }
 protected void btnSave_Click(object sender, EventArgs e)
 {
     divError.Visible = false;
     using (AccountBudget objAccountBudget = new AccountBudget())
     {
         objAccountBudget.AccountBudgetCategoryCode = "01";
         objAccountBudget.FiscalYearCode            = Convert.ToInt16(ddlFiscalYear.SelectedValue);
         objAccountBudget.ResponsibilityCode        = Request.QueryString["rccode"].ToString();
         objAccountBudget.ChargeTypeCode            = "01";
         objAccountBudget.AccountItemCode           = Convert.ToInt16(ddlAccountItem.SelectedValue);
         objAccountBudget.BudgetValue  = Convert.ToDouble(txtInitialBudget.Text);
         objAccountBudget.Remarks      = txtRemarks.Text;
         objAccountBudget.CreatedBy    = Request.Cookies["Speedo"]["UserName"].ToString();
         objAccountBudget.CreatedOn    = DateTime.Now;
         objAccountBudget.ModifiedBy   = Request.Cookies["Speedo"]["UserName"].ToString();
         objAccountBudget.ModifiedOn   = DateTime.Now;
         objAccountBudget.RecordStatus = "1";
         if (AccountBudget.IsInitialBudgetExist(Convert.ToInt16(ddlFiscalYear.SelectedValue), Request.QueryString["rccode"].ToString(), Convert.ToInt16(ddlAccountItem.SelectedValue)) == false)
         {
             if (objAccountBudget.Insert() > 0)
             {
                 this.LoadGrid();
             }
         }
         else
         {
             divError.Visible = true;
             lblErrMsg.Text   = "Budget for the selected account item already initialized.";
         }
     }
 }
 /// <summary>Snippet for GetAccountBudget</summary>
 /// <remarks>
 /// This snippet has been automatically generated for illustrative purposes only.
 /// It may require modifications to work in your environment.
 /// </remarks>
 public void GetAccountBudget()
 {
     // Create client
     AccountBudgetServiceClient accountBudgetServiceClient = AccountBudgetServiceClient.Create();
     // Initialize request argument(s)
     string resourceName = "customers/[CUSTOMER]/accountBudgets/[ACCOUNT_BUDGET]";
     // Make the request
     AccountBudget response = accountBudgetServiceClient.GetAccountBudget(resourceName);
 }
 /// <summary>Snippet for GetAccountBudget</summary>
 /// <remarks>
 /// This snippet has been automatically generated for illustrative purposes only.
 /// It may require modifications to work in your environment.
 /// </remarks>
 public void GetAccountBudgetResourceNames()
 {
     // Create client
     AccountBudgetServiceClient accountBudgetServiceClient = AccountBudgetServiceClient.Create();
     // Initialize request argument(s)
     AccountBudgetName resourceName = AccountBudgetName.FromCustomerAccountBudget("[CUSTOMER]", "[ACCOUNT_BUDGET]");
     // Make the request
     AccountBudget response = accountBudgetServiceClient.GetAccountBudget(resourceName);
 }
Ejemplo n.º 6
0
        /// <summary>
        /// Update an existing entity
        /// </summary>
        /// <param name="cf">A company file that has been retrieved</param>
        /// <param name="entity">The entity to update</param>
        /// <param name="credentials">The credentials to access the company file</param>
        /// <param name="errorLevel"></param>
        /// <returns></returns>
        public string Update(CompanyFile cf, AccountBudget entity, ICompanyFileCredentials credentials,
                             ErrorLevel errorLevel = ErrorLevel.IgnoreWarnings)
        {
            var queryString = QueryStringFromErrorLevel(errorLevel);

            return
                (MakeApiPutRequestSync(
                     BuildUri(cf, entity.FinancialYear,
                              extraQueryString: queryString), entity, credentials));
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Update an existing entity
        /// </summary>
        /// <param name="cf">A company file that has been retrieved</param>
        /// <param name="entity">The entity to update</param>
        /// <param name="credentials">The credentials to access the company file</param>
        /// <param name="onComplete">The action to call when the operation is complete</param>
        /// <param name="onError">The action to call when the operation has an error</param>
        /// <param name="errorLevel"></param>
        public void Update(CompanyFile cf, AccountBudget entity, ICompanyFileCredentials credentials,
                           Action <HttpStatusCode, string> onComplete, Action <Uri, Exception> onError,
                           ErrorLevel errorLevel = ErrorLevel.IgnoreWarnings)
        {
            var queryString = QueryStringFromErrorLevel(errorLevel);

            MakeApiPutRequestDelegate(
                BuildUri(cf, entity.FinancialYear, extraQueryString: queryString),
                entity, credentials, onComplete, onError);
        }
Ejemplo n.º 8
0
        /// <summary>Snippet for GetAccountBudgetAsync</summary>
        /// <remarks>
        /// This snippet has been automatically generated for illustrative purposes only.
        /// It may require modifications to work in your environment.
        /// </remarks>
        public async Task GetAccountBudgetResourceNamesAsync()
        {
            // Create client
            AccountBudgetServiceClient accountBudgetServiceClient = await AccountBudgetServiceClient.CreateAsync();

            // Initialize request argument(s)
            AccountBudgetName resourceName = AccountBudgetName.FromCustomerAccountBudget("[CUSTOMER_ID]", "[ACCOUNT_BUDGET_ID]");
            // Make the request
            AccountBudget response = await accountBudgetServiceClient.GetAccountBudgetAsync(resourceName);
        }
        /// <summary>Snippet for GetAccountBudgetAsync</summary>
        /// <remarks>
        /// This snippet has been automatically generated for illustrative purposes only.
        /// It may require modifications to work in your environment.
        /// </remarks>
        public async Task GetAccountBudgetAsync()
        {
            // Create client
            AccountBudgetServiceClient accountBudgetServiceClient = await AccountBudgetServiceClient.CreateAsync();

            // Initialize request argument(s)
            string resourceName = "customers/[CUSTOMER_ID]/accountBudgets/[ACCOUNT_BUDGET_ID]";
            // Make the request
            AccountBudget response = await accountBudgetServiceClient.GetAccountBudgetAsync(resourceName);
        }
 /// <summary>Snippet for GetAccountBudget</summary>
 public void GetAccountBudgetResourceNames()
 {
     // Snippet: GetAccountBudget(AccountBudgetName, CallSettings)
     // Create client
     AccountBudgetServiceClient accountBudgetServiceClient = AccountBudgetServiceClient.Create();
     // Initialize request argument(s)
     AccountBudgetName resourceName = AccountBudgetName.FromCustomerAccountBudget("[CUSTOMER_ID]", "[ACCOUNT_BUDGET_ID]");
     // Make the request
     AccountBudget response = accountBudgetServiceClient.GetAccountBudget(resourceName);
     // End snippet
 }
Ejemplo n.º 11
0
        /// <summary>
        /// Update an existing entity
        /// </summary>
        /// <param name="cf">A company file that has been retrieved</param>
        /// <param name="entity">The entity to update</param>
        /// <param name="credentials">The credentials to access the company file</param>
        /// <param name="errorLevel"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        public Task <string> UpdateAsync(CompanyFile cf, AccountBudget entity, ICompanyFileCredentials credentials,
                                         CancellationToken cancellationToken,
                                         ErrorLevel errorLevel = ErrorLevel.IgnoreWarnings)
        {
            var queryString = QueryStringFromErrorLevel(errorLevel);

            return
                (this.MakeApiPutRequestAsync(
                     this.BuildUri(cf, entity.FinancialYear,
                                   extraQueryString: queryString), entity, credentials, cancellationToken));
        }
 /// <summary>Snippet for GetAccountBudget</summary>
 public void GetAccountBudget()
 {
     // Snippet: GetAccountBudget(string, CallSettings)
     // Create client
     AccountBudgetServiceClient accountBudgetServiceClient = AccountBudgetServiceClient.Create();
     // Initialize request argument(s)
     string resourceName = "customers/[CUSTOMER_ID]/accountBudgets/[ACCOUNT_BUDGET_ID]";
     // Make the request
     AccountBudget response = accountBudgetServiceClient.GetAccountBudget(resourceName);
     // End snippet
 }
 /// <summary>Snippet for GetAccountBudget</summary>
 /// <remarks>
 /// This snippet has been automatically generated for illustrative purposes only.
 /// It may require modifications to work in your environment.
 /// </remarks>
 public void GetAccountBudgetRequestObject()
 {
     // Create client
     AccountBudgetServiceClient accountBudgetServiceClient = AccountBudgetServiceClient.Create();
     // Initialize request argument(s)
     GetAccountBudgetRequest request = new GetAccountBudgetRequest
     {
         ResourceNameAsAccountBudgetName = AccountBudgetName.FromCustomerAccountBudget("[CUSTOMER_ID]", "[ACCOUNT_BUDGET_ID]"),
     };
     // Make the request
     AccountBudget response = accountBudgetServiceClient.GetAccountBudget(request);
 }
Ejemplo n.º 14
0
        /// <summary>Snippet for GetAccountBudgetAsync</summary>
        /// <remarks>
        /// This snippet has been automatically generated for illustrative purposes only.
        /// It may require modifications to work in your environment.
        /// </remarks>
        public async Task GetAccountBudgetRequestObjectAsync()
        {
            // Create client
            AccountBudgetServiceClient accountBudgetServiceClient = await AccountBudgetServiceClient.CreateAsync();

            // Initialize request argument(s)
            GetAccountBudgetRequest request = new GetAccountBudgetRequest
            {
                ResourceNameAsAccountBudgetName = AccountBudgetName.FromCustomerAccountBudget("[CUSTOMER]", "[ACCOUNT_BUDGET]"),
            };
            // Make the request
            AccountBudget response = await accountBudgetServiceClient.GetAccountBudgetAsync(request);
        }
        /// <summary>Snippet for GetAccountBudgetAsync</summary>
        public async Task GetAccountBudgetAsync()
        {
            // Snippet: GetAccountBudgetAsync(string, CallSettings)
            // Additional: GetAccountBudgetAsync(string, CancellationToken)
            // Create client
            AccountBudgetServiceClient accountBudgetServiceClient = await AccountBudgetServiceClient.CreateAsync();

            // Initialize request argument(s)
            string resourceName = "customers/[CUSTOMER_ID]/accountBudgets/[ACCOUNT_BUDGET_ID]";
            // Make the request
            AccountBudget response = await accountBudgetServiceClient.GetAccountBudgetAsync(resourceName);

            // End snippet
        }
        /// <summary>Snippet for GetAccountBudgetAsync</summary>
        public async Task GetAccountBudgetResourceNamesAsync()
        {
            // Snippet: GetAccountBudgetAsync(AccountBudgetName, CallSettings)
            // Additional: GetAccountBudgetAsync(AccountBudgetName, CancellationToken)
            // Create client
            AccountBudgetServiceClient accountBudgetServiceClient = await AccountBudgetServiceClient.CreateAsync();

            // Initialize request argument(s)
            AccountBudgetName resourceName = AccountBudgetName.FromCustomerAccountBudget("[CUSTOMER_ID]", "[ACCOUNT_BUDGET_ID]");
            // Make the request
            AccountBudget response = await accountBudgetServiceClient.GetAccountBudgetAsync(resourceName);

            // End snippet
        }
Ejemplo n.º 17
0
    public void LoadList()
    {
        foreach (DataRow drAccountBudget in AccountBudget.GetDSG(ddlDivision.SelectedValue.ToString(), Convert.ToInt16(ddlFiscalYear.SelectedValue)).Rows)
        {
            Response.Write("<tr>");
            Response.Write("<td class='GridRows'><a href='AccountBudgetMaintenance.aspx?rccode=" + drAccountBudget["rccode"] + "'>" + drAccountBudget["rccode"] + "</td>");
            Response.Write("<td class='GridRows'>" + drAccountBudget["rcname"] + "</td>");
            if (Convert.ToDouble(drAccountBudget["bud_value"]) < 0)
            {
                Response.Write("<td class='GridRows' style='text-align:right;'>(" + (Convert.ToDouble(drAccountBudget["bud_value"]) * -1).ToString("###,##0.00") + ")</td>");
            }
            else
            {
                Response.Write("<td class='GridRows' style='text-align:right;'>" + Convert.ToDouble(drAccountBudget["bud_value"]).ToString("###,##0.00") + "</td>");
            }
            if (Convert.ToDouble(drAccountBudget["availed_value"]) < 0)
            {
                Response.Write("<td class='GridRows' style='text-align:right;'>(" + (Convert.ToDouble(drAccountBudget["availed_value"]) * -1).ToString("###,##0.00") + ")</td>");
            }
            else
            {
                Response.Write("<td class='GridRows' style='text-align:right;'>" + Convert.ToDouble(drAccountBudget["availed_value"]).ToString("###,##0.00") + "</td>");
            }
            if ((Convert.ToDouble(drAccountBudget["bud_value"]) - Convert.ToDouble(drAccountBudget["availed_value"])) < 0)
            {
                Response.Write("<td class='GridRows' style='text-align:right;'>(" + ((Convert.ToDouble(drAccountBudget["bud_value"]) - Convert.ToDouble(drAccountBudget["availed_value"])) * -1).ToString("###,##0.00") + ")</td>");
            }
            else
            {
                Response.Write("<td class='GridRows' style='text-align:right;'>" + (Convert.ToDouble(drAccountBudget["bud_value"]) - Convert.ToDouble(drAccountBudget["availed_value"])).ToString("###,##0.00") + "</td>");
            }
            Response.Write("</tr>");
            //Response.Write("<tr>");
        }
        //Response.Write("<tr>");
        //Response.Write("<td class='GridRows'>1</td>");
        //Response.Write("<td class='GridRows'>Management Information Systems</td>");
        //Response.Write("<td class='GridRows' style='text-align:right;'>10,000,000</td>");
        //Response.Write("<td class='GridRows' style='text-align:right;'>5,000,000</td>");
        //Response.Write("<td class='GridRows' style='text-align:right;'>5,000,000</td>");
        //Response.Write("</tr>");
        //Response.Write("<tr>");

        //Response.Write("<td class='GridRows2' colspan='2'>Category 1</td>");
        //Response.Write("<td class='GridRows2' style='text-align:right;'>10,000,000</td>");
        //Response.Write("<td class='GridRows2' style='text-align:right;'>5,000,000</td>");
        //Response.Write("<td class='GridRows2' style='text-align:right;'>5,000,000</td>");
        //Response.Write("</tr>");
    }
Ejemplo n.º 18
0
        public void GetAccountBudget2()
        {
            Mock <AccountBudgetService.AccountBudgetServiceClient> mockGrpcClient = new Mock <AccountBudgetService.AccountBudgetServiceClient>(MockBehavior.Strict);
            GetAccountBudgetRequest request = new GetAccountBudgetRequest
            {
                ResourceName = new AccountBudgetName("[CUSTOMER]", "[ACCOUNT_BUDGET]").ToString(),
            };
            AccountBudget expectedResponse = new AccountBudget
            {
                ResourceName = "resourceName2625949903",
            };

            mockGrpcClient.Setup(x => x.GetAccountBudget(request, It.IsAny <CallOptions>()))
            .Returns(expectedResponse);
            AccountBudgetServiceClient client = new AccountBudgetServiceClientImpl(mockGrpcClient.Object, null);
            AccountBudget response            = client.GetAccountBudget(request);

            Assert.AreEqual(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
Ejemplo n.º 19
0
        public async Task GetAccountBudgetAsync()
        {
            Mock <AccountBudgetService.AccountBudgetServiceClient> mockGrpcClient = new Mock <AccountBudgetService.AccountBudgetServiceClient>(MockBehavior.Strict);
            GetAccountBudgetRequest expectedRequest = new GetAccountBudgetRequest
            {
                ResourceName = new AccountBudgetName("[CUSTOMER]", "[ACCOUNT_BUDGET]").ToString(),
            };
            AccountBudget expectedResponse = new AccountBudget
            {
                ResourceName = "resourceName2625949903",
            };

            mockGrpcClient.Setup(x => x.GetAccountBudgetAsync(expectedRequest, It.IsAny <CallOptions>()))
            .Returns(new Grpc.Core.AsyncUnaryCall <AccountBudget>(Task.FromResult(expectedResponse), null, null, null, null));
            AccountBudgetServiceClient client   = new AccountBudgetServiceClientImpl(mockGrpcClient.Object, null);
            string        formattedResourceName = new AccountBudgetName("[CUSTOMER]", "[ACCOUNT_BUDGET]").ToString();
            AccountBudget response = await client.GetAccountBudgetAsync(formattedResourceName);

            Assert.AreEqual(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
Ejemplo n.º 20
0
        protected override OpResult _Store(AccountBudget _obj)
        {
            if (_obj == null)
            {
                return(OpResult.NotifyStoreAction(OpResult.ResultStatus.ObjectIsNull, _obj, "AccountBudget object cannot be created as it is null"));
            }

            if (Exists(_obj))
            {
                ExecuteNonQuery(GetQuery_UpdateQuery(_obj));
                return(OpResult.NotifyStoreAction(OpResult.ResultStatus.Updated, _obj));
            }

            ExecuteNonQuery(GetQuery_InsertQuery(_obj));
            if (_obj.AccountBudgetID == null)
            {
                _obj.AccountBudgetID = DbMgr.GetLastInsertID();
            }
            _obj.FromDb = true;

            return(OpResult.NotifyStoreAction(OpResult.ResultStatus.Created, _obj));
        }
    protected void btnSave_Click(object sender, EventArgs e)
    {
        divError.Visible = false;
        using (AccountBudget objAccountBudget = new AccountBudget())
        {
            objAccountBudget.AccountBudgetCategoryCode = ddlBudgetCategory.SelectedValue.ToString();
            objAccountBudget.FiscalYearCode            = Convert.ToInt16(ddlFiscalYear.SelectedValue);
            objAccountBudget.ResponsibilityCode        = Request.QueryString["rccode"].ToString();
            objAccountBudget.ChargeTypeCode            = "01";
            objAccountBudget.AccountItemCode           = Convert.ToInt16(Request.QueryString["accnt_items_code"]);
            objAccountBudget.BudgetValue  = Convert.ToDouble(txtAmount.Text);
            objAccountBudget.Remarks      = txtRemarks.Text;
            objAccountBudget.CreatedBy    = Request.Cookies["Speedo"]["UserName"].ToString();
            objAccountBudget.CreatedOn    = DateTime.Now;
            objAccountBudget.ModifiedBy   = Request.Cookies["Speedo"]["UserName"].ToString();
            objAccountBudget.ModifiedOn   = DateTime.Now;
            objAccountBudget.RecordStatus = "1";

            if (objAccountBudget.Insert() > 0)
            {
                this.LoadGrid();
            }
        }
    }
Ejemplo n.º 22
0
        /// <summary>
        /// Runs the code example.
        /// </summary>
        /// <param name="client">The Google Ads client.</param>
        /// <param name="customerId">The Google Ads customer ID for which the call is made.</param>
        public void Run(GoogleAdsClient client, long customerId)
        {
            // Get the GoogleAdsServiceClient.
            GoogleAdsServiceClient googleAdsService = client.GetService(
                Services.V3.GoogleAdsService);

            // Construct a GAQL query which will retrieve AccountBudgetProposals.
            String searchQuery =
                @"SELECT
                    account_budget.status,
                    account_budget.billing_setup,
                    account_budget.approved_spending_limit_micros,
                    account_budget.approved_spending_limit_type,
                    account_budget.proposed_spending_limit_micros,
                    account_budget.proposed_spending_limit_type,
                    account_budget.approved_start_date_time,
                    account_budget.proposed_start_date_time,
                    account_budget.approved_end_date_time,
                    account_budget.approved_end_time_type,
                    account_budget.proposed_end_date_time,
                    account_budget.proposed_end_time_type
                 FROM
                     account_budget";

            // Creates a request that will retrieve all account budgets using pages of the
            // specified page size.
            SearchGoogleAdsRequest request = new SearchGoogleAdsRequest()
            {
                PageSize   = PAGE_SIZE,
                Query      = searchQuery,
                CustomerId = customerId.ToString()
            };

            try
            {
                // Issues the search request.
                PagedEnumerable <SearchGoogleAdsResponse, GoogleAdsRow> searchPagedResponse =
                    googleAdsService.Search(request);

                // Iterates over all rows in all pages and prints the requested field values for
                // the account budget in each row.
                foreach (GoogleAdsRow googleAdsRow in searchPagedResponse)
                {
                    AccountBudget budget = googleAdsRow.AccountBudget;

                    Console.WriteLine(String.Format("Account budget '{0}' with status '{1}', " +
                                                    "billing setup '{2}', amount served {3:0.00}, total adjustments " +
                                                    "{4:0.00}, approved spending limit '{5}' (proposed '{6}'), approved " +
                                                    "start time '{7}' (proposed '{8}'), approved end time '{9}' " +
                                                    "(proposed '{10}')",
                                                    budget.ResourceName,
                                                    budget.Status,
                                                    budget.BillingSetup,
                                                    budget.AmountServedMicros.Value / 1_000_000.0,
                                                    budget.TotalAdjustmentsMicros.Value / 1_000_000.0,
                                                    budget.ApprovedSpendingLimitMicros.HasValue
                            ? String.Format(
                                                        "%.2f", budget.ApprovedSpendingLimitMicros.Value / 1_000_000.0)
                            : budget.ApprovedSpendingLimitType.ToString(),
                                                    budget.ProposedSpendingLimitMicros.HasValue
                            ? String.Format(
                                                        "%.2f", budget.ProposedSpendingLimitMicros.Value / 1_000_000.0)
                            : budget.ProposedSpendingLimitType.ToString(),
                                                    budget.ApprovedStartDateTime,
                                                    budget.ProposedStartDateTime,
                                                    String.IsNullOrEmpty(budget.ApprovedEndDateTime)
                            ? budget.ApprovedEndTimeType.ToString()
                            : budget.ApprovedEndDateTime,
                                                    String.IsNullOrEmpty(budget.ProposedEndDateTime)
                            ? budget.ProposedEndTimeType.ToString()
                            : budget.ProposedEndDateTime));
                }
            }
            catch (GoogleAdsException e)
            {
                Console.WriteLine("Failure:");
                Console.WriteLine($"Message: {e.Message}");
                Console.WriteLine($"Failure: {e.Failure}");
                Console.WriteLine($"Request ID: {e.RequestId}");
                throw;
            }
        }
Ejemplo n.º 23
0
        /// <summary>
        /// Runs the code example.
        /// </summary>
        /// <param name="client">The Google Ads client.</param>
        /// <param name="customerId">The Google Ads customer ID for which the call is made.</param>
        public void Run(GoogleAdsClient client, long customerId)
        {
            // Get the GoogleAdsServiceClient.
            GoogleAdsServiceClient googleAdsService = client.GetService(
                Services.V4.GoogleAdsService);

            // Construct a GAQL query which will retrieve AccountBudgetProposals.
            String query =
                @"SELECT
                    account_budget.status,
                    account_budget.billing_setup,
                    account_budget.approved_spending_limit_micros,
                    account_budget.approved_spending_limit_type,
                    account_budget.proposed_spending_limit_micros,
                    account_budget.proposed_spending_limit_type,
                    account_budget.adjusted_spending_limit_micros,
                    account_budget.adjusted_spending_limit_type,
                    account_budget.approved_start_date_time,
                    account_budget.proposed_start_date_time,
                    account_budget.approved_end_date_time,
                    account_budget.approved_end_time_type,
                    account_budget.proposed_end_date_time,
                    account_budget.proposed_end_time_type
                 FROM
                     account_budget";

            try
            {
                // Issues the search request.
                googleAdsService.SearchStream(customerId.ToString(), query,
                                              delegate(SearchGoogleAdsStreamResponse resp)
                {
                    // Displays the results
                    foreach (GoogleAdsRow googleAdsRow in resp.Results)
                    {
                        AccountBudget budget = googleAdsRow.AccountBudget;

                        Console.WriteLine(String.Format("Account budget '{0}' with status '{1}', " +
                                                        "billing setup '{2}', amount served {3:0.00}, total adjustments " +
                                                        "{4:0.00}, approved spending limit '{5}' (proposed '{6}', " +
                                                        "adjusted '{7}'), approved start time '{8}' (proposed '{9}'), " +
                                                        "approved end time '{10}' (proposed '{11}')",
                                                        budget.ResourceName,
                                                        budget.Status,
                                                        budget.BillingSetup,
                                                        budget.AmountServedMicros.Value / 1_000_000.0,
                                                        budget.TotalAdjustmentsMicros.Value / 1_000_000.0,
                                                        budget.ApprovedSpendingLimitMicros.HasValue
                                    ? String.Format(
                                                            "%.2f", budget.ApprovedSpendingLimitMicros.Value / 1_000_000.0)
                                    : budget.ApprovedSpendingLimitType.ToString(),
                                                        budget.ProposedSpendingLimitMicros.HasValue
                                    ? String.Format(
                                                            "%.2f", budget.ProposedSpendingLimitMicros.Value / 1_000_000.0)
                                    : budget.ProposedSpendingLimitType.ToString(),
                                                        budget.AdjustedSpendingLimitMicros.HasValue
                                    ? String.Format(
                                                            "%.2f", budget.AdjustedSpendingLimitMicros.Value / 1_000_000.0)
                                    : budget.AdjustedSpendingLimitType.ToString(),
                                                        budget.ApprovedStartDateTime,
                                                        budget.ProposedStartDateTime,
                                                        String.IsNullOrEmpty(budget.ApprovedEndDateTime)
                                    ? budget.ApprovedEndTimeType.ToString()
                                    : budget.ApprovedEndDateTime,
                                                        String.IsNullOrEmpty(budget.ProposedEndDateTime)
                                    ? budget.ProposedEndTimeType.ToString()
                                    : budget.ProposedEndDateTime));
                    }
                }
                                              );
            }
            catch (GoogleAdsException e)
            {
                Console.WriteLine("Failure:");
                Console.WriteLine($"Message: {e.Message}");
                Console.WriteLine($"Failure: {e.Failure}");
                Console.WriteLine($"Request ID: {e.RequestId}");
                throw;
            }
        }
Ejemplo n.º 24
0
 private DbUpdateStatement GetQuery_UpdateQuery(AccountBudget _obj)
 {
     return(DbMgr.CreateUpdateClause("AccountBudgets", GetFields(_obj), "AccountBudgetID", _obj.AccountBudgetID));
 }
    public void LoadGrid()
    {
        //string strWrite = "";
        //int intCounter = 0;
        //double dblCategoryBudget = 0;
        //double dblCategoryAvailed = 0;
        //double dblCategoryVariant = 0;
        //double dblCategoryTotalBudget = 0;
        //double dblCategoryTotalAvailed = 0;
        //foreach (DataRow drCategory in AccountCategory.GetDSG().Rows)
        //{
        //    foreach (DataRow drAccountItems in AccountBudget.GetDSGRCBudget(clsEmployee.GetRCCode(Request.Cookies["Speedo"]["UserName"].ToString()), Convert.ToInt16(ddlFiscalYear.SelectedValue), drCategory["accnt_cat_code"].ToString()).Rows)
        //    {
        //        intCounter += 1;
        //        strWrite += "<tr>";
        //        strWrite += "<td class='GridRows'>" + drAccountItems["oracle_code"] + "</td>";
        //        strWrite += "<td class='GridRows'>" + drAccountItems["accnt_items_name"] + "</td>";
        //        if (Convert.ToDouble(drAccountItems["bud_value"]) < 0)//negative
        //        {
        //            strWrite += "<td class='GridRows' style='text-align:right;'><a href='AccountBudgetAdjustmentViewer.aspx?rccode=" + clsEmployee.GetRCCode(Request.Cookies["Speedo"]["UserName"].ToString()) + "&accnt_cat_code=" + drCategory["accnt_cat_code"].ToString() + "&accnt_items_code=" + drAccountItems["accnt_items_code"] + "'>(" + (Convert.ToDouble(drAccountItems["bud_value"]) * -1).ToString("###,##0.00") + ")</a></td>";
        //        }
        //        else //positive
        //        {
        //            strWrite += "<td class='GridRows' style='text-align:right;'><a href='AccountBudgetAdjustmentViewer.aspx?rccode=" + clsEmployee.GetRCCode(Request.Cookies["Speedo"]["UserName"].ToString()) + "&accnt_cat_code=" + drCategory["accnt_cat_code"].ToString() + "&accnt_items_code=" + drAccountItems["accnt_items_code"] + "'>" + Convert.ToDouble(drAccountItems["bud_value"]).ToString("###,##0.00") + "</a></td>";
        //        }
        //        if (Convert.ToDouble(drAccountItems["availed_value"]) < 0) //negative
        //        {
        //            strWrite += "<td class='GridRows' style='text-align:right;'><a href='AccountBudgetActualsViewer.aspx?rccode=" + clsEmployee.GetRCCode(Request.Cookies["Speedo"]["UserName"].ToString()) + "&accnt_cat_code=" + drCategory["accnt_cat_code"].ToString() + "&accnt_items_code=" + drAccountItems["accnt_items_code"] + "'>(" + (Convert.ToDouble(drAccountItems["availed_value"]) * -1).ToString("###,##0.00") + ")</a></td>";
        //        }
        //        else //positive
        //        {
        //            strWrite += "<td class='GridRows' style='text-align:right;'><a href='AccountBudgetActualsViewer.aspx?rccode=" + clsEmployee.GetRCCode(Request.Cookies["Speedo"]["UserName"].ToString()) + "&accnt_cat_code=" + drCategory["accnt_cat_code"].ToString() + "&accnt_items_code=" + drAccountItems["accnt_items_code"] + "'>" + Convert.ToDouble(drAccountItems["availed_value"]).ToString("###,##0.00") + "</a></td>";
        //        }
        //        if ((Convert.ToDouble(drAccountItems["bud_value"]) - Convert.ToDouble(drAccountItems["availed_value"])) < 0) //negative
        //        {
        //            strWrite += "<td class='GridRows' style='text-align:right;'>(" + ((Convert.ToDouble(drAccountItems["bud_value"]) - Convert.ToDouble(drAccountItems["availed_value"])) * -1).ToString("###,##0.00") + ")</td>";
        //        }
        //        else //positive
        //        {
        //            strWrite += "<td class='GridRows' style='text-align:right;'>" + (Convert.ToDouble(drAccountItems["bud_value"]) - Convert.ToDouble(drAccountItems["availed_value"])).ToString("###,##0.00") + "</td>";
        //        }
        //        strWrite += "</tr>";
        //        strWrite += "<tr>";

        //        dblCategoryBudget += Convert.ToDouble(drAccountItems["bud_value"]);
        //        dblCategoryAvailed += Convert.ToDouble(drAccountItems["availed_value"]);
        //    }

        //    strWrite += "<td class='GridRows2' colspan='2'>&nbsp;&nbsp;" + drCategory["accnt_cat_name"].ToString() + "</td>";
        //    if (dblCategoryBudget < 0)
        //    {
        //        strWrite += "<td class='GridRows2' style='text-align:right;'>(" + (dblCategoryBudget * -1).ToString("###,##0.00") + ")</td>";
        //    }
        //    else
        //    {
        //        strWrite += "<td class='GridRows2' style='text-align:right;'>" + dblCategoryBudget.ToString("###,##0.00") + "</td>";
        //    }
        //    if (dblCategoryAvailed < 0)
        //    {
        //        strWrite += "<td class='GridRows2' style='text-align:right;'>(" + (dblCategoryAvailed * -1).ToString("###,##0.00") + ")</td>";
        //    }
        //    else
        //    {
        //        strWrite += "<td class='GridRows2' style='text-align:right;'>" + dblCategoryAvailed.ToString("###,##0.00") + "</td>";
        //    }
        //    if ((dblCategoryBudget - dblCategoryAvailed) < 0)
        //    {
        //        strWrite += "<td class='GridRows2' style='text-align:right;'>(" + ((dblCategoryBudget - dblCategoryAvailed) * -1).ToString("###,##0.00") + ")</td>";
        //    }
        //    else
        //    {
        //        strWrite += "<td class='GridRows2' style='text-align:right;'>" + (dblCategoryBudget - dblCategoryAvailed).ToString("###,##0.00") + "</td>";
        //    }
        //    strWrite += "</tr>";

        //    dblCategoryTotalBudget += dblCategoryBudget;
        //    dblCategoryTotalAvailed += dblCategoryAvailed;
        //    dblCategoryBudget = 0;
        //    dblCategoryAvailed = 0;

        //    //strWrite += "<td class='GridRows2' colspan='2'>Category 1</td>";
        //    //strWrite += "<td class='GridRows2' style='text-align:right;'>10,000,000</td>";
        //    //strWrite += "<td class='GridRows2' style='text-align:right;'>5,000,000</td>";
        //    //strWrite += "<td class='GridRows2' style='text-align:right;'>5,000,000</td>";
        //    //strWrite += "</tr>";
        //}
        //strWrite += "<tr>";
        //strWrite += "<td class='GridRows' style='text-align:right;' colspan='2'>TOTAL</td>";
        //if (dblCategoryTotalBudget < 0)
        //{
        //    strWrite += "<td class='GridRows' style='text-align:right;'>(" + (dblCategoryTotalBudget * -1).ToString("###,##0.00") + ")</td>";
        //}
        //else
        //{
        //    strWrite += "<td class='GridRows' style='text-align:right;'>" + dblCategoryTotalBudget.ToString("###,##0.00") + "</td>";
        //}
        //if (dblCategoryTotalAvailed < 0)
        //{
        //    strWrite += "<td class='GridRows' style='text-align:right;'>(" + (dblCategoryTotalAvailed * -1).ToString("###,##0.00") + ")</td>";
        //}
        //else
        //{
        //    strWrite += "<td class='GridRows' style='text-align:right;'>" + dblCategoryTotalAvailed.ToString("###,##0.00") + "</td>";
        //}
        //if ((dblCategoryTotalBudget - dblCategoryTotalAvailed) < 0)
        //{
        //    strWrite += "<td class='GridRows' style='text-align:right;'>(" + ((dblCategoryTotalBudget - dblCategoryTotalAvailed) * -1).ToString("###,##0.00") + ")</td>";
        //}
        //else
        //{
        //    strWrite += "<td class='GridRows' style='text-align:right;'>" + (dblCategoryTotalBudget - dblCategoryTotalAvailed).ToString("###,##0.00") + "</td>";
        //}
        //strWrite += "</tr>";
        //strWrite += "<tr>";

        //lblItems.Text = strWrite;

        string strWrite                = "";
        int    intCounter              = 0;
        double dblCategoryBudget       = 0;
        double dblCategoryAvailed      = 0;
        double dblCategoryVariant      = 0;
        double dblCategoryTotalBudget  = 0;
        double dblCategoryTotalAvailed = 0;
        double dblTotalIncomeBudget    = 0;
        double dblTotalIncomeAvailed   = 0;
        double dblTotalExpensesBudget  = 0;
        double dblTotalExpensesAvailed = 0;

        foreach (DataRow drCategoryType in AccountCategoryType.GetDSG().Rows)
        {
            foreach (DataRow drCategory in AccountCategory.GetDSG(drCategoryType["accnt_cat_type_code"].ToString()).Rows)
            {
                foreach (DataRow drAccountItems in AccountBudget.GetDSGRCBudget(clsEmployee.GetRCCode(Request.Cookies["Speedo"]["UserName"].ToString()), Convert.ToInt16(ddlFiscalYear.SelectedValue), drCategory["accnt_cat_code"].ToString()).Rows)
                {
                    intCounter += 1;
                    strWrite   += "<tr>";
                    strWrite   += "<td class='GridRows'>" + drAccountItems["oracle_code"] + "</td>";
                    strWrite   += "<td class='GridRows'>" + drAccountItems["accnt_items_name"] + "</td>";
                    if (Convert.ToDouble(drAccountItems["bud_value"]) < 0)//negative
                    {
                        strWrite += "<td class='GridRows' style='text-align:right;'><a href='AccountBudgetAdjustmentViewer.aspx?rccode=" + clsEmployee.GetRCCode(Request.Cookies["Speedo"]["UserName"].ToString()).ToString() + "&accnt_cat_code=" + drCategory["accnt_cat_code"].ToString() + "&accnt_items_code=" + drAccountItems["accnt_items_code"] + "'>(" + (Convert.ToDouble(drAccountItems["bud_value"]) * -1).ToString("###,##0.00") + ")</a></td>";
                    }
                    else //positive
                    {
                        strWrite += "<td class='GridRows' style='text-align:right;'><a href='AccountBudgetAdjustmentViewer.aspx?rccode=" + clsEmployee.GetRCCode(Request.Cookies["Speedo"]["UserName"].ToString()).ToString() + "&accnt_cat_code=" + drCategory["accnt_cat_code"].ToString() + "&accnt_items_code=" + drAccountItems["accnt_items_code"] + "'>" + Convert.ToDouble(drAccountItems["bud_value"]).ToString("###,##0.00") + "</a></td>";
                    }
                    if (Convert.ToDouble(drAccountItems["availed_value"]) < 0) //negative
                    {
                        strWrite += "<td class='GridRows' style='text-align:right;'><a href='AccountBudgetActualsViewer.aspx?rccode=" + clsEmployee.GetRCCode(Request.Cookies["Speedo"]["UserName"].ToString()).ToString() + "&accnt_cat_code=" + drCategory["accnt_cat_code"].ToString() + "&accnt_items_code=" + drAccountItems["accnt_items_code"] + "'>(" + (Convert.ToDouble(drAccountItems["availed_value"]) * -1).ToString("###,##0.00") + ")</a></td>";
                    }
                    else //positive
                    {
                        strWrite += "<td class='GridRows' style='text-align:right;'><a href='AccountBudgetActualsViewer.aspx?rccode=" + clsEmployee.GetRCCode(Request.Cookies["Speedo"]["UserName"].ToString()).ToString() + "&accnt_cat_code=" + drCategory["accnt_cat_code"].ToString() + "&accnt_items_code=" + drAccountItems["accnt_items_code"] + "'>" + Convert.ToDouble(drAccountItems["availed_value"]).ToString("###,##0.00") + "</a></td>";
                    }
                    if ((Convert.ToDouble(drAccountItems["bud_value"]) - Convert.ToDouble(drAccountItems["availed_value"])) < 0) //negative
                    {
                        strWrite += "<td class='GridRows' style='text-align:right;'>(" + ((Convert.ToDouble(drAccountItems["bud_value"]) - Convert.ToDouble(drAccountItems["availed_value"])) * -1).ToString("###,##0.00") + ")</td>";
                    }
                    else //positive
                    {
                        strWrite += "<td class='GridRows' style='text-align:right;'>" + (Convert.ToDouble(drAccountItems["bud_value"]) - Convert.ToDouble(drAccountItems["availed_value"])).ToString("###,##0.00") + "</td>";
                    }
                    strWrite += "</tr>";
                    strWrite += "<tr>";

                    dblCategoryBudget  += Convert.ToDouble(drAccountItems["bud_value"]);
                    dblCategoryAvailed += Convert.ToDouble(drAccountItems["availed_value"]);
                }

                strWrite += "<td class='GridRows2' colspan='2'>&nbsp;&nbsp;" + drCategory["accnt_cat_name"].ToString() + "</td>";
                if (dblCategoryBudget < 0)
                {
                    strWrite += "<td class='GridRows2' style='text-align:right;'>(" + (dblCategoryBudget * -1).ToString("###,##0.00") + ")</td>";
                }
                else
                {
                    strWrite += "<td class='GridRows2' style='text-align:right;'>" + dblCategoryBudget.ToString("###,##0.00") + "</td>";
                }
                if (dblCategoryAvailed < 0)
                {
                    strWrite += "<td class='GridRows2' style='text-align:right;'>(" + (dblCategoryAvailed * -1).ToString("###,##0.00") + ")</td>";
                }
                else
                {
                    strWrite += "<td class='GridRows2' style='text-align:right;'>" + dblCategoryAvailed.ToString("###,##0.00") + "</td>";
                }
                if ((dblCategoryBudget - dblCategoryAvailed) < 0)
                {
                    strWrite += "<td class='GridRows2' style='text-align:right;'>(" + ((dblCategoryBudget - dblCategoryAvailed) * -1).ToString("###,##0.00") + ")</td>";
                }
                else
                {
                    strWrite += "<td class='GridRows2' style='text-align:right;'>" + (dblCategoryBudget - dblCategoryAvailed).ToString("###,##0.00") + "</td>";
                }
                strWrite += "</tr>";

                dblCategoryTotalBudget  += dblCategoryBudget;
                dblCategoryTotalAvailed += dblCategoryAvailed;
                dblCategoryBudget        = 0;
                dblCategoryAvailed       = 0;

                if (drCategoryType["accnt_cat_type_code"].ToString() == "01")
                {
                    dblTotalIncomeBudget  += dblCategoryBudget;
                    dblTotalIncomeAvailed += dblCategoryTotalAvailed;
                }
                if (drCategoryType["accnt_cat_type_code"].ToString() == "02")
                {
                    dblTotalExpensesBudget  += dblCategoryBudget;
                    dblTotalExpensesAvailed += dblCategoryAvailed;
                }
            }

            strWrite += "<tr>";
            strWrite += "<td class='GridRows' style='text-align:right;' colspan='2'>TOTAL " + drCategoryType["accnt_cat_type_name"].ToString() + "</td>";
            if (dblCategoryTotalBudget < 0)
            {
                strWrite += "<td class='GridRows' style='text-align:right;'>(" + (dblCategoryTotalBudget * -1).ToString("###,##0.00") + ")</td>";
            }
            else
            {
                strWrite += "<td class='GridRows' style='text-align:right;'>" + dblCategoryTotalBudget.ToString("###,##0.00") + "</td>";
            }
            if (dblCategoryTotalAvailed < 0)
            {
                strWrite += "<td class='GridRows' style='text-align:right;'>(" + (dblCategoryTotalAvailed * -1).ToString("###,##0.00") + ")</td>";
            }
            else
            {
                strWrite += "<td class='GridRows' style='text-align:right;'>" + dblCategoryTotalAvailed.ToString("###,##0.00") + "</td>";
            }
            if ((dblCategoryTotalBudget - dblCategoryTotalAvailed) < 0)
            {
                strWrite += "<td class='GridRows' style='text-align:right;'>(" + ((dblCategoryTotalBudget - dblCategoryTotalAvailed) * -1).ToString("###,##0.00") + ")</td>";
            }
            else
            {
                strWrite += "<td class='GridRows' style='text-align:right;'>" + (dblCategoryTotalBudget - dblCategoryTotalAvailed).ToString("###,##0.00") + "</td>";
            }
            strWrite += "</tr>";
            strWrite += "<tr>";

            dblCategoryTotalBudget  = 0;
            dblCategoryTotalAvailed = 0;
        }
        lblItems.Text = strWrite;
    }
Ejemplo n.º 26
0
 /// <summary>
 /// Update an existing entity
 /// </summary>
 /// <param name="cf">A company file that has been retrieved</param>
 /// <param name="entity">The entity to update</param>
 /// <param name="credentials">The credentials to access the company file</param>
 /// <param name="errorLevel"></param>
 /// <returns></returns>
 public Task <string> UpdateAsync(CompanyFile cf, AccountBudget entity, ICompanyFileCredentials credentials,
                                  ErrorLevel errorLevel = ErrorLevel.IgnoreWarnings)
 {
     return(this.UpdateAsync(cf, entity, credentials, CancellationToken.None, errorLevel));
 }
Ejemplo n.º 27
0
        private DbInsertStatement GetQuery_InsertQuery(AccountBudget _obj)
        {
            Dictionary <string, DbFieldEntry> fields = GetFields(_obj);

            return(DbMgr.CreateInsertClause("AccountBudgets", fields));
        }
    public void LoadGrid()
    {
        string strWrite                = "";
        int    intCounter              = 0;
        double dblCategoryBudget       = 0;
        double dblCategoryAvailed      = 0;
        double dblCategoryVariant      = 0;
        double dblCategoryTotalBudget  = 0;
        double dblCategoryTotalAvailed = 0;
        double dblTotalIncomeBudget    = 0;
        double dblTotalIncomeAvailed   = 0;
        double dblTotalExpensesBudget  = 0;
        double dblTotalExpensesAvailed = 0;

        foreach (DataRow drCategoryType in AccountCategoryType.GetDSG().Rows)
        {
            foreach (DataRow drCategory in AccountCategory.GetDSG(drCategoryType["accnt_cat_type_code"].ToString()).Rows)
            {
                foreach (DataRow drAccountItems in AccountBudget.GetDSGRCBudget(Request.QueryString["rccode"].ToString(), Convert.ToInt16(Request.QueryString["fiscal_year_code"].ToString()), drCategory["accnt_cat_code"].ToString()).Rows)
                {
                    intCounter += 1;
                    strWrite   += "<tr>";
                    strWrite   += "<td class='GridRows'>" + drAccountItems["oracle_code"] + "</td>";
                    strWrite   += "<td class='GridRows'>" + drAccountItems["accnt_items_name"] + "</td>";
                    if (Convert.ToDouble(drAccountItems["bud_value"]) < 0)//negative
                    {
                        strWrite += "<td class='GridRows' style='text-align:right;'><a href='AccountBudgetAdjustment.aspx?rccode=" + Request.QueryString["rccode"].ToString() + "&accnt_cat_code=" + drCategory["accnt_cat_code"].ToString() + "&accnt_items_code=" + drAccountItems["accnt_items_code"] + "'>(" + (Convert.ToDouble(drAccountItems["bud_value"]) * -1).ToString("###,##0.00") + ")</a></td>";
                    }
                    else //positive
                    {
                        strWrite += "<td class='GridRows' style='text-align:right;'><a href='AccountBudgetAdjustment.aspx?rccode=" + Request.QueryString["rccode"].ToString() + "&accnt_cat_code=" + drCategory["accnt_cat_code"].ToString() + "&accnt_items_code=" + drAccountItems["accnt_items_code"] + "'>" + Convert.ToDouble(drAccountItems["bud_value"]).ToString("###,##0.00") + "</a></td>";
                    }
                    if (Convert.ToDouble(drAccountItems["availed_value"]) < 0) //negative
                    {
                        strWrite += "<td class='GridRows' style='text-align:right;'><a href='AccountBudgetActuals.aspx?rccode=" + Request.QueryString["rccode"].ToString() + "&accnt_cat_code=" + drCategory["accnt_cat_code"].ToString() + "&accnt_items_code=" + drAccountItems["accnt_items_code"] + "'>(" + (Convert.ToDouble(drAccountItems["availed_value"]) * -1).ToString("###,##0.00") + ")</a></td>";
                    }
                    else //positive
                    {
                        strWrite += "<td class='GridRows' style='text-align:right;'><a href='AccountBudgetActuals.aspx?rccode=" + Request.QueryString["rccode"].ToString() + "&accnt_cat_code=" + drCategory["accnt_cat_code"].ToString() + "&accnt_items_code=" + drAccountItems["accnt_items_code"] + "'>" + Convert.ToDouble(drAccountItems["availed_value"]).ToString("###,##0.00") + "</a></td>";
                    }
                    if ((Convert.ToDouble(drAccountItems["bud_value"]) - Convert.ToDouble(drAccountItems["availed_value"])) < 0) //negative
                    {
                        strWrite += "<td class='GridRows' style='text-align:right;'>(" + ((Convert.ToDouble(drAccountItems["bud_value"]) - Convert.ToDouble(drAccountItems["availed_value"])) * -1).ToString("###,##0.00") + ")</td>";
                    }
                    else //positive
                    {
                        strWrite += "<td class='GridRows' style='text-align:right;'>" + (Convert.ToDouble(drAccountItems["bud_value"]) - Convert.ToDouble(drAccountItems["availed_value"])).ToString("###,##0.00") + "</td>";
                    }
                    strWrite += "</tr>";
                    strWrite += "<tr>";

                    dblCategoryBudget  += Convert.ToDouble(drAccountItems["bud_value"]);
                    dblCategoryAvailed += Convert.ToDouble(drAccountItems["availed_value"]);
                }

                strWrite += "<td class='GridRows2' colspan='2'>&nbsp;&nbsp;" + drCategory["accnt_cat_name"].ToString() + "</td>";
                if (dblCategoryBudget < 0)
                {
                    strWrite += "<td class='GridRows2' style='text-align:right;'>(" + (dblCategoryBudget * -1).ToString("###,##0.00") + ")</td>";
                }
                else
                {
                    strWrite += "<td class='GridRows2' style='text-align:right;'>" + dblCategoryBudget.ToString("###,##0.00") + "</td>";
                }
                if (dblCategoryAvailed < 0)
                {
                    strWrite += "<td class='GridRows2' style='text-align:right;'>(" + (dblCategoryAvailed * -1).ToString("###,##0.00") + ")</td>";
                }
                else
                {
                    strWrite += "<td class='GridRows2' style='text-align:right;'>" + dblCategoryAvailed.ToString("###,##0.00") + "</td>";
                }
                if ((dblCategoryBudget - dblCategoryAvailed) < 0)
                {
                    strWrite += "<td class='GridRows2' style='text-align:right;'>(" + ((dblCategoryBudget - dblCategoryAvailed) * -1).ToString("###,##0.00") + ")</td>";
                }
                else
                {
                    strWrite += "<td class='GridRows2' style='text-align:right;'>" + (dblCategoryBudget - dblCategoryAvailed).ToString("###,##0.00") + "</td>";
                }
                strWrite += "</tr>";

                dblCategoryTotalBudget  += dblCategoryBudget;
                dblCategoryTotalAvailed += dblCategoryAvailed;
                dblCategoryBudget        = 0;
                dblCategoryAvailed       = 0;

                if (drCategoryType["accnt_cat_type_code"].ToString() == "01")
                {
                    dblTotalIncomeBudget  += dblCategoryBudget;
                    dblTotalIncomeAvailed += dblCategoryTotalAvailed;
                }
                if (drCategoryType["accnt_cat_type_code"].ToString() == "02")
                {
                    dblTotalExpensesBudget  += dblCategoryBudget;
                    dblTotalExpensesAvailed += dblCategoryAvailed;
                }
            }

            strWrite += "<tr>";
            strWrite += "<td class='GridRows' style='text-align:right;' colspan='2'>TOTAL " + drCategoryType["accnt_cat_type_name"].ToString() + "</td>";
            if (dblCategoryTotalBudget < 0)
            {
                strWrite += "<td class='GridRows' style='text-align:right;'>(" + (dblCategoryTotalBudget * -1).ToString("###,##0.00") + ")</td>";
            }
            else
            {
                strWrite += "<td class='GridRows' style='text-align:right;'>" + dblCategoryTotalBudget.ToString("###,##0.00") + "</td>";
            }
            if (dblCategoryTotalAvailed < 0)
            {
                strWrite += "<td class='GridRows' style='text-align:right;'>(" + (dblCategoryTotalAvailed * -1).ToString("###,##0.00") + ")</td>";
            }
            else
            {
                strWrite += "<td class='GridRows' style='text-align:right;'>" + dblCategoryTotalAvailed.ToString("###,##0.00") + "</td>";
            }
            if ((dblCategoryTotalBudget - dblCategoryTotalAvailed) < 0)
            {
                strWrite += "<td class='GridRows' style='text-align:right;'>(" + ((dblCategoryTotalBudget - dblCategoryTotalAvailed) * -1).ToString("###,##0.00") + ")</td>";
            }
            else
            {
                strWrite += "<td class='GridRows' style='text-align:right;'>" + (dblCategoryTotalBudget - dblCategoryTotalAvailed).ToString("###,##0.00") + "</td>";
            }
            strWrite += "</tr>";
            strWrite += "<tr>";

            dblCategoryTotalBudget  = 0;
            dblCategoryTotalAvailed = 0;
        }
        lblItems.Text = strWrite;
    }