예제 #1
0
    protected void rptEntry_OnItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        AdhocInvoiceItem adhocInv = (AdhocInvoiceItem)e.Item.DataItem;

        if (adhocInv != null)
        {
            Entry entry = Entry.GetEntry(adhocInv.EntryId);

            Label lbNo = (Label)e.Item.FindControl("lbNo");
            if (lbNo != null)
            {
                lbNo.Text = counter.ToString();
            }
            Label lbSerialNo = (Label)e.Item.FindControl("lbSerialNo");
            if (lbSerialNo != null)
            {
                lbSerialNo.Text = entry.Serial;
            }
            Label lblTitle = (Label)e.Item.FindControl("lblTitle");
            if (lblTitle != null)
            {
                lblTitle.Text = entry.Campaign;
            }
            Label lbCategory = (Label)e.Item.FindControl("lblCategory");
            if (lbCategory != null)
            {
                lbCategory.Text = Data.GetCategoryMarket(entry.CategoryMarket) + " <br> " + entry.CategoryPSDetail;
            }
            Label lbDesc = (Label)e.Item.FindControl("lbDesc");
            if (lbDesc != null)
            {
                if (!adhocInv.InvoiceType.Equals(AdhocInvoiceType.Custom))
                {
                    lbDesc.Text = GeneralFunction.GetInvoiceType(adhocInv.InvoiceType);
                }
                else
                {
                    lbDesc.Text = adhocInv.InvoiceTypeOthers;
                }
            }
            Label lbFees = (Label)e.Item.FindControl("lbFees");
            if (lbFees != null)
            {
                lbFees.Text = adhocInv.Amount.ToString("N");
            }
            counter++;
        }
    }
예제 #2
0
    public static Guid GetAdminidAssignedto(Guid PayGroupId, Guid Id)
    {
        Guid AdminidAssignedto = Guid.Empty;

        try
        {
            AdhocInvoiceItem adhocInvoiceItem = AdhocInvoiceItemList.GetAdhocInvoiceItemList(PayGroupId, Id).FirstOrDefault();
            Entry            entry            = Entry.GetEntry(adhocInvoiceItem.EntryId);

            Administrator administrator = AdministratorList.GetAdministratorList().Where(x => x.Id == entry.AdminidAssignedto).FirstOrDefault();
            AdminidAssignedto = administrator.Id;
        }
        catch { }

        return(AdminidAssignedto);
    }
예제 #3
0
    protected void btnGenerateInvoice_Click(object sender, EventArgs e)
    {
        if (ValidateForm())
        {
            regId = Request.QueryString["regId"];

            if (regId != null && !String.IsNullOrEmpty(regId))
            {
                regGuidId = new Guid(GeneralFunction.StringDecryption(regId));
            }

            reg = Registration.GetRegistration(regGuidId);

            Guid payGroupId = Guid.NewGuid();

            decimal totalAmount = 0;

            AdhocInvoice adInvoice = AdhocInvoice.NewAdhocInvoice();
            adInvoice.PayGroupId     = payGroupId;
            adInvoice.RegistrationId = reg.Id;

            foreach (GridDataItem item in radGridEntry.Items)
            {
                DropDownList ddlInvoiceType   = (DropDownList)item.FindControl("ddlInvoiceType");
                TextBox      txtAmount        = (TextBox)item.FindControl("txtAmount");
                TextBox      txtInvoiceCustom = (TextBox)item.FindControl("txtInvoiceCustom");
                HiddenField  hdfId            = (HiddenField)item.FindControl("hdfId");

                CheckBox chkbox = (CheckBox)item.FindControl("chkbox");

                if (chkbox.Checked)
                {
                    AdhocInvoiceItem adInvoiceItem = AdhocInvoiceItem.NewAdhocInvoiceItem();

                    adInvoiceItem.Amount = Decimal.Parse(txtAmount.Text.Trim());

                    adInvoiceItem.AdhocInvoiceId    = adInvoice.Id;
                    adInvoiceItem.EntryId           = new Guid(hdfId.Value.ToString());
                    adInvoiceItem.InvoiceType       = ddlInvoiceType.SelectedValue;
                    adInvoiceItem.InvoiceTypeOthers = txtInvoiceCustom.Text.Trim();

                    adInvoiceItem.PayGroupId = payGroupId;

                    adInvoiceItem.DateCreatedString  = DateTime.Now.ToString();
                    adInvoiceItem.DateModifiedString = DateTime.Now.ToString();

                    if (adInvoiceItem.IsValid)
                    {
                        adInvoiceItem.Save();
                    }
                }
            }

            adInvoice.DateCreatedString  = DateTime.Now.ToString();
            adInvoice.DateModifiedString = DateTime.Now.ToString();

            if (adInvoice.IsValid)
            {
                adInvoice.Save();
            }

            string InvoiceUrl = "AdhocInvoiceSummary.aspx?adm=e&pgId=" + GeneralFunction.StringEncryption(payGroupId.ToString());
            if (entrySelected != null)
            {
                InvoiceUrl = "AdhocInvoiceSummary.aspx?adm=e&pgId=" + GeneralFunction.StringEncryption(payGroupId.ToString()) + "&EntryId=" + GeneralFunction.StringEncryption(entrySelected.Id.ToString());
                if (!string.IsNullOrEmpty(Request.QueryString["Page"]))
                {
                    InvoiceUrl += "&Page=Management";
                }
            }

            GeneralFunction.SetRedirect(string.Empty);
            Response.Redirect(InvoiceUrl);
        }
    }
예제 #4
0
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        if (ValidateForm())
        {
            Guid             paygroupId  = new Guid(hldEntryId.Value);
            string           InvoiceType = "";
            AdhocInvoiceList adInvList   = AdhocInvoiceList.GetAdhocInvoiceList(Guid.Empty, paygroupId);
            adInv = AdhocInvoice.GetAdhocInvoice(adInvList[0].Id);
            Registration reg     = null;
            string       invoice = "";
            try
            {
                AdhocInvoiceItem adhocInvoiceItem = AdhocInvoiceItemList.GetAdhocInvoiceItemList(adInvList[0].PayGroupId, adInvList[0].Id)[0];
                InvoiceType = adhocInvoiceItem.InvoiceType;
                reg         = Registration.GetRegistration(adInvList[0].RegistrationId);
                invoice     = adInvList[0].Invoice;
            }
            catch { }

            // save the amount to the first entry or this default entry
            adInv.AmountReceived += decimal.Parse(txtAmountRecieved.Text);
            adInv.Save();


            // paid?
            bool   isPaid         = false;
            Guid   paymentGroupId = adInv.PayGroupId;
            string paidstatus_org = adInv.PayStatus;

            if (chkPaid.Checked && paidstatus_org == StatusPaymentEntry.NotPaid)
            {
                adInv.PayStatus = StatusPaymentEntry.Paid;
                isPaid          = true;
                adInv.Save();

                if (!string.IsNullOrEmpty(invoice))// AD-HOC INVOICE – CONFIRMATION OF PAYMENT
                {
                    if (InvoiceType == AdhocInvoiceType.ReOpen)
                    {
                        Email.SendAdhocReOpenPaymentEmailConfirm(reg, paygroupId, invoice);
                    }
                    else if (InvoiceType == AdhocInvoiceType.ChangeReq || InvoiceType == AdhocInvoiceType.Custom || InvoiceType == AdhocInvoiceType.ExtDeadLine)
                    {
                        Email.SendAdhocOtherRequestPaymentEmailConfirm(reg, paygroupId, invoice);
                    }

                    adInv.LastSendPaidEmailDateString = DateTime.Now.ToString();
                }
            }
            if (!chkPaid.Checked && paidstatus_org == StatusPaymentEntry.Paid)
            {
                adInv.PayStatus = StatusPaymentEntry.NotPaid;
            }

            adInv.Save();



            // send email? if sent before do not send any more
            string lastdatesent = GeneralFunction.CleanDateTimeToString(adInv.LastSendPaidEmailDate, "dd/MM/yy HH:mm tt");
            //if (lastdatesent == "")
            //{
            //    if (adInv.PaymentMethod != PaymentType.PayPal)
            //    {
            //        if (IsAmountFullyPaidIncludeThisAmount())
            //            // Full payment
            //            GeneralFunction.CompleteNewEntrySubmissionOthers(paymentGroupId);
            //        else
            //        {
            //            // Partial payment
            //            Email.SendAllowUploadEmailOthers(Registration.GetRegistration(list[0].RegistrationId), paymentGroupId, "");
            //            GeneralFunction.UpdateEntryLastSendPaidEmailDate(paymentGroupId);
            //        }
            //    }
            //}


            Administrator admin = Security.GetAdminLoginSession();
            // history
            AdhocInvoiceAmountReceived amt = AdhocInvoiceAmountReceived.NewAdhocInvoiceAmountReceived();
            amt.Amount             = decimal.Parse(txtAmountRecieved.Text);
            amt.DateReceivedString = dpDateReceived.DateInput.SelectedDate.ToString();
            amt.PaygroupId         = adInv.PayGroupId;
            amt.Invoice            = adInv.Invoice;
            amt.Remarks            = txtRemarks.Text;
            amt.IsSetPaid          = isPaid;
            amt.DateCreatedString  = DateTime.Now.ToString();
            if (admin != null)
            {
                amt.isAdmin       = true;
                amt.CommentatorID = admin.Id;
            }
            else
            {
                amt.isAdmin       = false;
                amt.CommentatorID = reg.Id;
            }
            amt.Save();



            if (Save_Clicked != null)
            {
                Save_Clicked(this, EventArgs.Empty);
            }
        }
    }