Пример #1
0
    protected void radGridEntry_ItemDataBound(object sender, GridItemEventArgs e)
    {
        if (e.Item.ItemType == GridItemType.Item || e.Item.ItemType == GridItemType.AlternatingItem)
        {
            Effie2017.App.AdhocInvoiceItem adInvItem = (Effie2017.App.AdhocInvoiceItem)e.Item.DataItem;
            Entry entry = Entry.GetEntry(adInvItem.EntryId);


            Label lbl = null;

            // serial
            lbl      = (Label)e.Item.FindControl("lblSerial");
            lbl.Text = entry.Serial;

            // desc
            lbl      = (Label)e.Item.FindControl("lblDesc");
            lbl.Text = adInvItem.InvoiceType.Equals(AdhocInvoiceType.Custom) ? adInvItem.InvoiceTypeOthers : GeneralFunction.GetInvoiceType(adInvItem.InvoiceType);


            // submitted by
            lbl = (Label)e.Item.FindControl("lblSubmittedBy");
            Registration reg = Registration.GetRegistration(entry.RegistrationId);
            lbl.Text = "-";
            if (reg != null)
            {
                lbl.Text = GeneralFunction.GetRegistrationFromEntry(entry).Company;
            }
        }
    }
Пример #2
0
    protected void radGridEntryAdhoc_ItemDataBound(object sender, GridItemEventArgs e)
    {
        if (e.Item.ItemType == GridItemType.Item || e.Item.ItemType == GridItemType.AlternatingItem)
        {
            Effie2017.App.AdhocInvoiceItem adhocInvoiceItem = (Effie2017.App.AdhocInvoiceItem)e.Item.DataItem;
            Effie2017.App.AdhocInvoice     adhocInvoice     = Effie2017.App.AdhocInvoice.GetAdhocInvoice(adhocInvoiceItem.AdhocInvoiceId);
            LinkButton lnkBtn = null;

            lnkBtn = (LinkButton)e.Item.FindControl("lnkBtnDelete");
            lnkBtn.Attributes.Add("onclick", "return DeleteConfirmation('Entry');");

            LinkButton EditButton = (LinkButton)e.Item.FindControl("lnkBtnEditAdhoc");
            EditButton.CommandArgument = adhocInvoice.PayGroupId.ToString();
            Security.SecureControlByHiding(lnkBtn);
            EditButton.Visible = true;

            HyperLink View = (HyperLink)e.Item.FindControl("lnkInvoiceAdhoc");
            View.NavigateUrl = "../Admin/AdhocPaymentPdfView.aspx?regId=" + GeneralFunction.StringEncryption(adhocInvoice.RegistrationId.ToString()) + "&adId=" + GeneralFunction.StringEncryption(adhocInvoice.Id.ToString());

            ((GridDataItem)e.Item)["DateModified"].Text = adhocInvoiceItem.DateModified.ToString("dd/MM/yy");
            ((GridDataItem)e.Item)["AmountPaid"].Text   = adhocInvoice.AmountReceived.ToString("0.00");

            ((GridDataItem)e.Item)["PaymentMethod"].Text = GeneralFunction.GetPaymentType(adhocInvoice.PaymentMethod);
            string PaymentMethod = ((GridDataItem)e.Item)["PaymentMethod"].Text;
            if (!string.IsNullOrEmpty(PaymentMethod))
            {
                decimal Grant = adhocInvoice.GrandAmount;
                if (Grant == 0)
                {
                    Grant = Convert.ToDecimal(((GridDataItem)e.Item)["GrandAmount"].Text);
                }

                ((GridDataItem)e.Item)["GrandAmount"].Text = Grant.ToString("0.00");
                ((GridDataItem)e.Item)["BalanceDue"].Text  = (Convert.ToDecimal(((GridDataItem)e.Item)["GrandAmount"].Text) - Convert.ToDecimal(((GridDataItem)e.Item)["AmountPaid"].Text)).ToString("0.00");

                AdhocamountInvoiced += Grant;
                AdhocamountPaid     += Convert.ToDecimal(((GridDataItem)e.Item)["AmountPaid"].Text);
                AdhocbalanceDue     += Convert.ToDecimal(((GridDataItem)e.Item)["BalanceDue"].Text);
                EditButton.Text      = "Edit";
            }
            else
            {
                View.Visible    = false;
                EditButton.Text = "Choose payment method";
                ((GridDataItem)e.Item)["GrandAmount"].Text   = "0.00";
                ((GridDataItem)e.Item)["BalanceDue"].Text    = "0.00";
                ((GridDataItem)e.Item)["PaymentMethod"].Text = "<span style='font-weight: bold;'>please choose your payment method</span>";
            }

            lblAdhocAmountInvoiced.Text = AdhocamountInvoiced.ToString("0.00");
            lblAdhocAmountPaid.Text     = AdhocamountPaid.ToString("0.00");
            lblAdhocBalanceDue.Text     = AdhocbalanceDue.ToString("0.00");
        }
    }