示例#1
0
        protected void RadButtonExcelDetail_OnClick(object sender, EventArgs e)
        {
            var filterExpression = ConvertFilterExpressionToSqlExpression(RadGridInvoice.MasterTableView.Columns, true);
            var tempDt           = new CInvoice().GetInvoiceDetailExcel(filterExpression);

            ExportExcel(tempDt, "Invoice Detail for pivot");
        }
示例#2
0
        protected void RadDatePickerEndDate_OnSelectedDateChanged(object sender, SelectedDateChangedEventArgs e)
        {
            var cInvoice    = new CInvoice();
            var invoiceInfo = cInvoice.Get(InvoiceId);

            var cProgramReg = new CProgramRegistration();
            var ProReg      = cProgramReg.Get(Convert.ToInt32(invoiceInfo.ProgramRegistrationId));

            if (RadDatePickerEndDate.SelectedDate > ProReg.EndDate)
            {
                RadDatePickerEndDate.SelectedDate = ProReg.EndDate;
            }
            if (RadDatePickerStartDate != null)
            {
                if (RadDatePickerEndDate.SelectedDate < RadDatePickerStartDate.SelectedDate)
                {
                    RadDatePickerEndDate.SelectedDate = RadDatePickerStartDate.SelectedDate;
                    RadNumericTextBoxBreakDays.Value  = 1;
                }
                else
                {
                    var days = new TimeSpan();
                    days = Convert.ToDateTime(RadDatePickerEndDate.SelectedDate) - Convert.ToDateTime(RadDatePickerStartDate.SelectedDate);
                    RadNumericTextBoxBreakDays.Value = Convert.ToInt32(days.Days) + 1;
                }
            }
            else
            {
                RadDatePickerStartDate.SelectedDate = RadDatePickerEndDate.SelectedDate;
                RadNumericTextBoxBreakDays.Value    = 1;
            }

            UpdatedEndDate();
        }
示例#3
0
        protected void tbTransferDate_SelectedDateChanged(object sender, SelectedDateChangedEventArgs e)
        {
            var cInvoice    = new CInvoice();
            var qryInvoice  = cInvoice.Get(InvoiceId);
            var cQryProRegi = new CProgramRegistration();
            var qryProRegi  = cQryProRegi.Get(Convert.ToInt32(qryInvoice.ProgramRegistrationId));

            var TransferDate = Convert.ToDateTime(tbTransferDate.SelectedDate);

            var StartDate         = Convert.ToDateTime(qryProRegi.StartDate);
            var EndDate           = Convert.ToDateTime(qryProRegi.EndDate);
            var totalProgramDays  = EndDate - StartDate;
            var totalTakenDays    = new TimeSpan();
            var totalTransferDays = new TimeSpan();

            if (TransferDate <= StartDate)
            {
                totalTransferDays = totalProgramDays;
            }
            else
            {
                totalTakenDays    = TransferDate - StartDate;
                totalTransferDays = totalProgramDays - totalTakenDays;
            }

            tbTotalDaysOfProgram.Value = Convert.ToInt32(totalProgramDays.Days);
            tbTotalTakenDays.Value     = Convert.ToInt32(totalTakenDays.Days);
            tbTransferDays.Value       = Convert.ToInt32(totalTransferDays.Days);
        }
示例#4
0
        protected void RadToolBarApproval_OnButtonClick(object sender, RadToolBarEventArgs e)
        {
            if (RadGridRefund.SelectedValue != null)
            {
                switch (e.Item.Text)
                {
                case "Request":
                    RunClientScript("ShowPop('" + RadGridRefund.SelectedValue + "', '1');");
                    break;

                case "Approve":
                    RunClientScript("ShowApprovalWindow('" + RadGridRefund.SelectedValue + "');");
                    break;

                case "Reject":
                    RunClientScript("ShowApprovalRejectWindow('" + RadGridRefund.SelectedValue + "');");
                    break;

                case "Revise":
                    RunClientScript("ShowApprovalReviseWindow('" + RadGridRefund.SelectedValue + "');");
                    break;

                case "Cancel":
                    RunClientScript("ShowApprovalCancelWindow('" + RadGridRefund.SelectedValue + "');");
                    break;

                case "View Original Invoice":
                    var cRefund  = new CRefund();
                    var refund   = cRefund.Get(Convert.ToInt32(RadGridRefund.SelectedValue));
                    var cInvoice = new CInvoice();
                    var invoice  = cInvoice.Get(refund.InvoiceId);
                    if (invoice.OriginalInvoiceId != null)
                    {
                        RunClientScript("ShowInvoiceWindow(" + invoice.OriginalInvoiceId + ");");
                    }
                    break;

                case "Student Page":
                    Response.Redirect("~/Student?id=" + RadGridRefund.SelectedValues["StudentId"]);
                    break;

                case "Invoice Page":
                    Response.Redirect("~/Invoice?id=" + RadGridRefund.SelectedValues["StudentId"]);
                    break;

                case "Payment Page":
                    Response.Redirect("~/Payment?id=" + RadGridRefund.SelectedValues["StudentId"]);
                    break;

                case "Deposit Page":
                    Response.Redirect("~/Deposit?id=" + RadGridRefund.SelectedValues["StudentId"]);
                    break;

                case "CreditMemo Page":
                    Response.Redirect("~/CreditMemo?id=" + RadGridRefund.SelectedValues["StudentId"]);
                    break;
                }
            }
        }
示例#5
0
    protected void GenerateInvoice(int DormitoryRegistrationId, int InvoiceType)
    {
        int InvoiceId = 0;
        // Generate Invoice
        var cInvoice = new CInvoice();
        var invoice  = new Invoice();

        invoice.DormitoryRegistrationId = DormitoryRegistrationId;
        invoice.StudentId      = Convert.ToInt32(ddlStudent.SelectedValue);
        invoice.SiteLocationId = CurrentSiteLocationId;
        invoice.InvoiceType    = InvoiceType;                         //11 Dormitory,14 Dormitory Schedule Change

        invoice.Status      = (int)CConstValue.InvoiceStatus.Pending; // Pending
        invoice.CreatedId   = CurrentUserId;
        invoice.CreatedDate = DateTime.Now;

        InvoiceId = cInvoice.Add(invoice); //DB:Invoice
        if (InvoiceId > 0)
        {
            Decimal DormitoryPrice = 0;
            int     type           = 0;
            //New ERP DormitoryT_V06_20150108

            //DormitoryFee, Type=1
            type           = 1;
            DormitoryPrice = GetDormitoryPrice(CurrentSiteLocationId, type) * Convert.ToInt32(TxtDormitoryWeeks.Text.Trim().ToString());
            //Exta Days
            type = 6;
            Decimal Extra = GetDormitoryPrice(CurrentSiteLocationId, type) * Convert.ToInt32(TxtExtraDays.Text.Trim().ToString());

            DormitoryPrice = DormitoryPrice + Extra;
            GenerateInvoiceItem(InvoiceId, 21, DormitoryPrice); //Dormitory Fee
            type           = 2;
            DormitoryPrice = GetDormitoryPrice(CurrentSiteLocationId, type);
            GenerateInvoiceItem(InvoiceId, 23, DormitoryPrice); //Dormitory Placement Fee

            type           = 5;                                 //Dormitory Deposit Fee
            DormitoryPrice = GetDormitoryPrice(CurrentSiteLocationId, type);
            GenerateInvoiceItem(InvoiceId, 25, DormitoryPrice);


            if (ddl_pickup.SelectedValue == "2")
            {
                type           = 3;
                DormitoryPrice = GetDormitoryPrice(CurrentSiteLocationId, type);
                GenerateInvoiceItem(InvoiceId, 35, DormitoryPrice); //Airport Pick Up
            }
            if (ddlDropoff.SelectedValue == "2")
            {
                type           = 4;
                DormitoryPrice = GetDormitoryPrice(CurrentSiteLocationId, type);
                GenerateInvoiceItem(InvoiceId, 37, DormitoryPrice); //Airport Drop Off
            }


            //to present invoice
            ResetGridInvoice();
        }
    }
示例#6
0
        public RCertification(int invoiceId)
        {
            //
            // Required for telerik Reporting designer support
            //
            InitializeComponent();

            var invoice = new CInvoice().Get(invoiceId);

            if (invoice?.ProgramRegistrationId == null)
            {
                return;
            }

            var programRegistration = new CProgramRegistration().Get((int)invoice.ProgramRegistrationId);

            if (programRegistration == null)
            {
                return;
            }

            var cStudent = new CStudent();
            var student  = cStudent.Get((int)invoice.StudentId);

            if (student == null)
            {
                return;
            }

            var program      = new CProgram().Get(programRegistration.ProgramId);
            var siteLocation = new CSiteLocation().Get(student.SiteLocationId);
            var site         = new CSite().Get(siteLocation.SiteId);

            var weeks = programRegistration.Weeks == null ? string.Empty : programRegistration.Weeks + " weeks";
            var programDescription = program.ProgramFullName + (programRegistration.HrsStatus != null ? $"({programRegistration.HrsStatus}/week)" : string.Empty) + " Program";

            htmlTextBoxBody.Value = $@"This Certification awarded to<br>
<b>{cStudent.GetStudentFullName(student)}</b><br>
for successfully completing {weeks} in the<br>
<b>{programDescription}</b><br>
at {site.Name}, {siteLocation.Name}, ON, Canada";

            htmlTextBoxDate.Value = $"Dated : <b>{DateTime.Today.ToString("MM-dd-yy")}</b>";

            try
            {
                var signPath = new CGlobal().GetLogoImagePath((int)invoice.SiteLocationId, CConstValue.ImageType.Sign);
                if (signPath != string.Empty)
                {
                    pictureBoxSign.Value = Image.FromFile(signPath);
                }
            }
            catch (Exception ex)
            {
                Debug.Print(ex.Message);
            }
        }
示例#7
0
        private void CalRefundDate()
        {
            var refundDate = Convert.ToDateTime(RadDatePickerActualDate.SelectedDate);

            //if (RefundDate < RequestDate)
            //    tbRefundDate.SelectedDate = RequestDate;

            var cInvoice = new CInvoice();
            var invoice  = cInvoice.Get(InvoiceId);

            DateTime startDate = DateTime.Now;
            DateTime endDate   = DateTime.Now;

            // Program
            if (invoice.ProgramRegistrationId != null)
            {
                var cProgramRegiInfo = new CProgramRegistration();
                var programRegiInfo  = cProgramRegiInfo.Get(Convert.ToInt32(invoice.ProgramRegistrationId));
                startDate = Convert.ToDateTime(programRegiInfo.StartDate);
                endDate   = Convert.ToDateTime(programRegiInfo.EndDate);
            }
            // Homestay
            else if (invoice.HomestayRegistrationId != null)
            {
                var cHomestayPlacement     = new CHomestayPlacement();
                var homestayStudentRequest = cHomestayPlacement.GetByStudentBasicId(Convert.ToInt32(invoice.HomestayRegistrationId));
                startDate = Convert.ToDateTime(homestayStudentRequest.StartDate);
                endDate   = Convert.ToDateTime(homestayStudentRequest.EndDate);
            }
            // Dormitory
            else if (invoice.DormitoryRegistrationId != null)
            {
                var cDormitoryPlacement = new CDormitoryPlacement();
                var programRegiInfo     = cDormitoryPlacement.GetByStudentBasicId(Convert.ToInt32(invoice.DormitoryRegistrationId));
                startDate = Convert.ToDateTime(programRegiInfo.StartDate);
                endDate   = Convert.ToDateTime(programRegiInfo.EndDate);
            }

            if (refundDate < startDate)
            {
                RadNumericTextBoxRefundRate.Value = 100;
            }
            else
            {
                //////////////////////////////////////////
                //Refund Policy Method Call ( CRefund.cs )
                //////////////////////////////////////////
                var refundData = new CRefund();
                var rates      = refundData.RefundPolicy(startDate, endDate, refundDate, CurrentSiteLocationId);
                RadNumericTextBoxRefundRate.Value = rates[0];

                var studyRate = rates[1] > 100 ? 100 : rates[1];
                RadNumericTextBoxStudyRate.Value = studyRate;
            }
        }
示例#8
0
        protected void RadToolBarPaymentTop_OnButtonClick(object sender, RadToolBarEventArgs e)
        {
            if (RadGridPayment.SelectedValue != null)
            {
                switch (e.Item.Text)
                {
                case "Student Reciept":
                    RunClientScript("ShowReportPop('" + RadGridPayment.SelectedValue + "', '" + (int)CConstValue.Report.PaymentStudent + "');");
                    break;

                case "Agency Reciept":
                    RunClientScript("ShowReportPop('" + RadGridPayment.SelectedValue + "','" + (int)CConstValue.Report.PaymentAgency + "');");
                    break;

                case "Student Page":
                    Response.Redirect("~/Student?id=" + RadGridPayment.SelectedValues["StudentId"]);
                    break;

                case "Invoice Page":
                    Response.Redirect("~/Invoice?id=" + RadGridPayment.SelectedValues["StudentId"]);
                    break;

                case "Deposit Page":
                    Response.Redirect("~/Deposit?id=" + RadGridPayment.SelectedValues["StudentId"]);
                    break;

                case "CreditMemo Page":
                    Response.Redirect("~/CreditMemo?id=" + RadGridPayment.SelectedValues["StudentId"]);
                    break;

                case "Refund Page":
                    Response.Redirect("~/Refund?id=" + RadGridPayment.SelectedValues["StudentId"]);
                    break;

                case "Change status of Gross Based":
                    var cInvoice = new CInvoice();
                    var invoice  = cInvoice.Get(Convert.ToInt32(RadGridPayment.SelectedValue));
                    if (invoice != null)
                    {
                        invoice.IsGross   = !invoice.IsGross;
                        invoice.UpdatedId = CurrentUserId;
                        if (cInvoice.Update(invoice))
                        {
                            RadGridPayment.Rebind();
                            ShowMessage("Gross Based has been changed.");
                        }
                        else
                        {
                            ShowMessage("Error : Gross Based");
                        }
                    }
                    break;
                }
            }
        }
示例#9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            hfInvoiceId.Value = Request["id"];

            var cInvoice = new CInvoice();
            var invoice  = cInvoice.Get(Convert.ToInt32(hfInvoiceId.Value));

            LinqDataSource1.WhereParameters.Clear();
            LinqDataSource1.WhereParameters.Add("AvailableCreditAmount", DbType.Decimal, "0");
            LinqDataSource1.WhereParameters.Add("StudentId", DbType.Int32, invoice.StudentId.ToString());
            if (invoice.AgencyId == null)
            {
                LinqDataSource1.Where = "AvailableCreditAmount > @AvailableCreditAmount and StudentId == @StudentId and AgencyId == null";
            }
            else
            {
                LinqDataSource1.WhereParameters.Add("AgencyId", DbType.Int32, invoice.AgencyId.ToString());
                LinqDataSource1.Where = "AvailableCreditAmount > @AvailableCreditAmount and ((StudentId == @StudentId and AgencyId == null) or AgencyId == @AgencyId)";
            }

            if (!IsPostBack)
            {
                var global = new CGlobal();

                ddlPyamentMethod.DataSource     = global.GetDictionary(28);
                ddlPyamentMethod.DataTextField  = "Name";
                ddlPyamentMethod.DataValueField = "Value";
                ddlPyamentMethod.DataBind();

                ddlCurrency.Items.Insert(0, new RadComboBoxItem("CAD", "0"));
                ddlCurrency.Items.Insert(1, new RadComboBoxItem("USD", "1"));

                ttInvoice.Text = invoice.InvoiceNumber;

                ddlPyamentMethod.Visible = true;
                tbPaymentAmount.Visible  = true;
                ddlCurrency.Visible      = true;

                ddlCreditMemo.Visible  = false;
                tbCreditAmount.Visible = false;

                // default data
                btCheckPayment.Checked     = true;
                tbPaymentDate.SelectedDate = DateTime.Now;
            }
        }
示例#10
0
        protected void Page_Load(object sender, EventArgs e)
        {
            InvoiceId = Convert.ToInt32(Request["id"]);

            if (!IsPostBack)
            {
                FileDownloadList1.InitFileDownloadList((int)CConstValue.Upload.Break);

                var vwInvoice = new CInvoice().GetVwInvoice(InvoiceId);
                if (vwInvoice != null)
                {
                    RadDatePickerProgramStartDate.SelectedDate = vwInvoice.StartDate;
                    RadDatePickerProgramEndDate.SelectedDate   = vwInvoice.EndDate;
                }
                RadDatePickerStartDate.SelectedDate = DateTime.Today;
            }
        }
示例#11
0
        public void SetData()
        {
            var cUser = new CUser();
            var user  = cUser.Get(CurrentUserId);



            var invoice = new CInvoice().Get(Convert.ToInt32(ReportParameters["InvoiceId"].Value));

            if (invoice != null)
            {
                var logoPath = new CGlobal().GetLogoImagePath((int)invoice.SiteLocationId);
                if (logoPath != string.Empty)
                {
                    companyLogoPictureBox.Value = Image.FromFile(logoPath);
                }
            }
        }
示例#12
0
        public RInvoice(int reportType, int currentUserId, int invoiceId)
        {
            //
            // Required for telerik Reporting designer support
            //
            InitializeComponent();

            ReportParameters["InvoiceId"].Value = invoiceId;

            var cUser = new CUser();
            var user  = cUser.Get(currentUserId);

            textBoxInvoiceIssuer.Value = cUser.GetUserName(user);

            switch (reportType)
            {
            case (int)CConstValue.Report.InvoiceStudent:
                // default
                break;

            case (int)CConstValue.Report.InvoiceAgency:
                textBoxInvoiceTitle.Value = "Invoice (Net)";
                itemDescriptionTextBoxStudentPrice.Value = "= Fields.AgencyPrice";
                textBoxStudentPriceSum1.Value            = "=Sum(Fields.AgencyPrice)";
                textBoxStudentPriceSum2.Value            = "=Sum(Fields.AgencyPrice)";
                break;
            }

            var invoice = new CInvoice().Get(invoiceId);

            if (invoice != null)
            {
                var logoPath = new CGlobal().GetLogoImagePath((int)invoice.SiteLocationId, CConstValue.ImageType.Basic);
                if (logoPath != string.Empty)
                {
                    companyLogoPictureBox.Value = Image.FromFile(logoPath);
                }
            }
        }
示例#13
0
        protected void MainToolBar_ButtonClick(object sender, RadToolBarEventArgs e)
        {
            if (e.Item.Text == "Cancel" && !string.IsNullOrEmpty(hfId.Value))
            {
                if (IsValid)
                {
                    try
                    {
                        var type = Convert.ToInt32(hfType.Value);
                        var id   = Convert.ToInt32(hfId.Value);

                        var cApprovalHistory = new CApprovalHistory();
                        var approvalHistory  = cApprovalHistory.Get(type, id, CurrentUserId);

                        bool isExists = true;
                        if (approvalHistory == null)
                        {
                            approvalHistory = new ApprovalHistory();
                            approvalHistory.ApprovalUser = CurrentUserId;
                            isExists = false;
                        }

                        approvalHistory.ApprovalDate = DateTime.Now;
                        approvalHistory.ApprovalMemo = tbRemark.Text;
                        approvalHistory.ApprovalStep = (int)CConstValue.ApprovalStatus.Canceled;

                        // update approvalHistory
                        if (isExists)
                        {
                            cApprovalHistory.Update(approvalHistory);
                        }

                        if (type == (int)CConstValue.Approval.Refund)
                        {
                            var cRefund = new CRefund();
                            var refund  = cRefund.Get(id);
                            refund.ApprovalDate   = approvalHistory.ApprovalDate;
                            refund.ApprovalId     = approvalHistory.ApprovalUser;
                            refund.ApprovalMemo   = approvalHistory.ApprovalMemo;
                            refund.ApprovalStatus = approvalHistory.ApprovalStep;

                            if (cRefund.Update(refund))
                            {
                                var cInvoiceInfo = new CInvoice();
                                var invoiceInfo  = cInvoiceInfo.Get(refund.InvoiceId);

                                var cOriginalInvoiceInfo = new CInvoice();
                                var originalInvoiceInfo  = cOriginalInvoiceInfo.Get(Convert.ToInt32(invoiceInfo.OriginalInvoiceId));

                                invoiceInfo.Status    = (int)CConstValue.InvoiceStatus.Cancelled_RF; // Canceled_R
                                invoiceInfo.UpdatedId = CurrentUserId;

                                originalInvoiceInfo.Status    = (int)CConstValue.InvoiceStatus.Invoiced; // Invoiced
                                originalInvoiceInfo.UpdatedId = CurrentUserId;

                                cInvoiceInfo.Update(invoiceInfo);
                                cOriginalInvoiceInfo.Update(originalInvoiceInfo);
                            }
                        }
                        else if (type == (int)CConstValue.Approval.Agency)
                        {
                            var cAgency = new CAgency();
                            var agency  = cAgency.Get(id);
                            agency.ApprovalDate   = approvalHistory.ApprovalDate;
                            agency.ApprovalId     = approvalHistory.ApprovalUser;
                            agency.ApprovalMemo   = approvalHistory.ApprovalMemo;
                            agency.ApprovalStatus = approvalHistory.ApprovalStep;

                            cAgency.Update(agency);
                        }
                        else if (type == (int)CConstValue.Approval.CreditMemoPayout)
                        {
                            var cCreditMemoPayout = new CCreditMemoPayout();
                            var creditMemoPayout  = cCreditMemoPayout.Get(id);
                            creditMemoPayout.ApprovalDate   = approvalHistory.ApprovalDate;
                            creditMemoPayout.ApprovalId     = approvalHistory.ApprovalUser;
                            creditMemoPayout.ApprovalMemo   = approvalHistory.ApprovalMemo;
                            creditMemoPayout.ApprovalStatus = approvalHistory.ApprovalStep;

                            cCreditMemoPayout.Update(creditMemoPayout);
                        }
                        else if (type == (int)CConstValue.Approval.Package)
                        {
                            var cPackageProgram = new CPackageProgram();
                            var packageProgram  = cPackageProgram.GetPackageProgram(id);
                            packageProgram.ApprovalDate   = approvalHistory.ApprovalDate;
                            packageProgram.ApprovalId     = approvalHistory.ApprovalUser;
                            packageProgram.ApprovalMemo   = approvalHistory.ApprovalMemo;
                            packageProgram.ApprovalStatus = approvalHistory.ApprovalStep;

                            cPackageProgram.Update(packageProgram);
                        }
                        else if (type == (int)CConstValue.Approval.Promotion)
                        {
                            var cPromotion = new CPromotion();
                            var promotion  = cPromotion.Get(id);
                            promotion.ApprovalDate   = approvalHistory.ApprovalDate;
                            promotion.ApprovalId     = approvalHistory.ApprovalUser;
                            promotion.ApprovalMemo   = approvalHistory.ApprovalMemo;
                            promotion.ApprovalStatus = approvalHistory.ApprovalStep;

                            cPromotion.Update(promotion);
                        }
                        else if (type == (int)CConstValue.Approval.Scholarship)
                        {
                            var cScholarship = new CScholarship();
                            var scholarship  = cScholarship.Get(id);
                            scholarship.ApprovalDate   = approvalHistory.ApprovalDate;
                            scholarship.ApprovalId     = approvalHistory.ApprovalUser;
                            scholarship.ApprovalMemo   = approvalHistory.ApprovalMemo;
                            scholarship.ApprovalStatus = approvalHistory.ApprovalStep;

                            cScholarship.Update(scholarship);
                        }
                        else if (type == (int)CConstValue.Approval.CorporateCreditCard)
                        {
                            var cCorporateCreditCard = new CCorporateCreditCard();
                            var corporateCreditCard  = cCorporateCreditCard.Get(id);
                            corporateCreditCard.ApprovalDate   = approvalHistory.ApprovalDate;
                            corporateCreditCard.ApprovalId     = approvalHistory.ApprovalUser;
                            corporateCreditCard.ApprovalMemo   = approvalHistory.ApprovalMemo;
                            corporateCreditCard.ApprovalStatus = approvalHistory.ApprovalStep;

                            cCorporateCreditCard.Update(corporateCreditCard);
                        }
                        // BusinessTrip
                        else if (type == (int)CConstValue.Approval.BusinessTrip)
                        {
                            var cBusinessTrip = new CBusinessTrip();
                            var businessTrip  = cBusinessTrip.Get(id);
                            businessTrip.ApprovalDate   = approvalHistory.ApprovalDate;
                            businessTrip.ApprovalId     = approvalHistory.ApprovalUser;
                            businessTrip.ApprovalMemo   = approvalHistory.ApprovalMemo;
                            businessTrip.ApprovalStatus = approvalHistory.ApprovalStep;

                            cBusinessTrip.Update(businessTrip);
                        }
                        // Purchase Order
                        else if (type == (int)CConstValue.Approval.PurchaseOrder)
                        {
                            var cPurchaseOrder = new CPurchaseOrder();
                            var purchaseOrder  = cPurchaseOrder.Get(id);
                            purchaseOrder.ApprovalDate   = approvalHistory.ApprovalDate;
                            purchaseOrder.ApprovalId     = approvalHistory.ApprovalUser;
                            purchaseOrder.ApprovalMemo   = approvalHistory.ApprovalMemo;
                            purchaseOrder.ApprovalStatus = approvalHistory.ApprovalStep;

                            cPurchaseOrder.Update(purchaseOrder);
                        }
                        // Expense
                        else if (type == (int)CConstValue.Approval.Expense)
                        {
                            var cExpense = new CExpense();
                            var expense  = cExpense.Get(id);
                            expense.ApprovalDate   = approvalHistory.ApprovalDate;
                            expense.ApprovalId     = approvalHistory.ApprovalUser;
                            expense.ApprovalMemo   = approvalHistory.ApprovalMemo;
                            expense.ApprovalStatus = approvalHistory.ApprovalStep;

                            cExpense.Update(expense);
                        }
                        // Hire
                        else if (type == (int)CConstValue.Approval.Hire)
                        {
                            var cHire = new CHire();
                            var hire  = cHire.Get(id);
                            hire.ApprovalDate   = approvalHistory.ApprovalDate;
                            hire.ApprovalId     = approvalHistory.ApprovalUser;
                            hire.ApprovalMemo   = approvalHistory.ApprovalMemo;
                            hire.ApprovalStatus = approvalHistory.ApprovalStep;

                            cHire.Update(hire);
                        }
                        // Vacation
                        else if (type == (int)CConstValue.Approval.Vacation)
                        {
                            var cVacation = new CVacation();
                            var vacation  = cVacation.Get(id);
                            vacation.ApprovalDate   = approvalHistory.ApprovalDate;
                            vacation.ApprovalId     = approvalHistory.ApprovalUser;
                            vacation.ApprovalMemo   = approvalHistory.ApprovalMemo;
                            vacation.ApprovalStatus = approvalHistory.ApprovalStep;

                            cVacation.Update(vacation);
                        }

                        RunClientScript("Close();");
                    }
                    catch (Exception ex)
                    {
                        ShowMessage(ex.Message);
                    }
                }
            }
        }
示例#14
0
        public ROrientationForm(int invoiceId)
        {
            //
            // Required for telerik Reporting designer support
            //
            InitializeComponent();

            var invoice = new CInvoice().Get(invoiceId);

            if (invoice?.ProgramRegistrationId == null)
            {
                return;
            }

            var programRegistration = new CProgramRegistration().Get((int)invoice.ProgramRegistrationId);

            if (programRegistration == null)
            {
                return;
            }

            var cStudent = new CStudent();
            var student  = cStudent.Get((int)invoice.StudentId);

            if (student == null)
            {
                return;
            }

            var program      = new CProgram().Get(programRegistration.ProgramId);
            var siteLocation = new CSiteLocation().Get(student.SiteLocationId);
            var site         = new CSite().Get(siteLocation.SiteId);

            htmlTextBoxDate.Value = "Date : " + DateTime.Today.ToString("MM-dd-yy");

            textBoxRe.Value = $"RE: STUDENT ORIENTATION FOR {program.ProgramFullName}";

            htmlTextBoxBody.Value = $@"
<b>TO: {new CStudent().GetStudentFullName(student)} #{student.StudentNo}</b><br>
C/O: GLOBAL INTERCITY STUDENT CENTER<br><br>

We sincerely welcome you to {site.Name}. Your session starts {programRegistration.StartDate?.ToString("MM-dd-yy")}
and it is very important that you be here for your level placement and orientation.<br><br>

<b>ORIENTATION</b><br>
<b><u>{site.Abbreviation}'s orientation starts 9:00am {programRegistration.StartDate?.ToString("MM-dd-yy")} and students are asked to come to school
by no later than 8:50am.</u></b>Counselors will inform you on school policies, class schedules along with
a brief tour of the outlying area.<br>
<b><u>YOUR FIRST DAY AT SCHOOL INCLUDES</u></b><br>
1. A written placement test<br>
2. Orientation with counselors<br>
3. Individual oral interview with a school instructor<br><br>

<b>PLEASE MAKE SURE TO BRING FOLLOWNG ITEMS WITH YOU:</b><br>
1. A pencil and an eraser for the Placement Test<br>
2. A photocopy of your passport(the page with your passport photo)<br>
3. A photocopy of your Valid Immigration Document(Study Permit / Work Permit / Visitor's
Record)<br>
4. A photocopy of your Medical Insurance Document<br>
5. A photocopy of your Letter of Acceptance and the Refund Policy with your signatures on<br><br>

<b>CHANGE OF SCHEDULE</b><br>
<b>If you are not able to attend the placement/orientation, you must notify the school
immediately.</b><br><br>

<b>CLEARING CUSTOMS</b><br>
You may not study for over 6 months when entering Canada with a tourist visa. Please have with
you your {site.Abbreviation} Letter of Acceptance and Homestay detail. Also, it is a good idea to be prepared to
answer simple question that the customs officer may have for you.";


            try
            {
                var logoPath = new CGlobal().GetLogoImagePath((int)invoice.SiteLocationId, CConstValue.ImageType.Logo);
                if (logoPath != string.Empty)
                {
                    pictureBoxCompanyLogo.Value = Image.FromFile(logoPath);
                }
            }
            catch (Exception ex)
            {
                Debug.Print(ex.Message);
            }

            try
            {
                var sideLogoPath = new CGlobal().GetLogoImagePath((int)invoice.SiteLocationId, CConstValue.ImageType.LogoSide);
                if (sideLogoPath != string.Empty)
                {
                    pictureBoxSideLogo.Value = Image.FromFile(sideLogoPath);
                }
            }
            catch (Exception ex)
            {
                Debug.Print(ex.Message);
            }
        }
示例#15
0
        protected void ToolbarButtonClick(object sender, RadToolBarEventArgs e)
        {
            switch (e.Item.Text)
            {
            case "Request":
                if (IsValid)
                {
                    var cInvoice = new CInvoice();
                    var original = cInvoice.Get(InvoiceId);
                    if (original != null)
                    {
                        original.Status    = (int)CConstValue.InvoiceStatus.Invoiced_Hold;
                        original.UpdatedId = CurrentUserId;

                        if (cInvoice.Update(original))
                        {
                            var cRefundInvoice = new CInvoice();
                            var refundInvoice  = new Erp2016.Lib.Invoice();
                            CGlobal.Copy(original, refundInvoice);
                            refundInvoice.OriginalInvoiceId = original.InvoiceId;
                            switch (original.InvoiceType)
                            {
                            case (int)CConstValue.InvoiceType.General:
                            case (int)CConstValue.InvoiceType.Simple:
                            case (int)CConstValue.InvoiceType.Manual:
                                refundInvoice.InvoiceType = (int)CConstValue.InvoiceType.Refund_RF;
                                break;

                            case (int)CConstValue.InvoiceType.Homestay:
                                refundInvoice.InvoiceType = (int)CConstValue.InvoiceType.Refund_HR;
                                break;

                            case (int)CConstValue.InvoiceType.Dormitory:
                                refundInvoice.InvoiceType = (int)CConstValue.InvoiceType.Refund_DR;
                                break;
                            }
                            refundInvoice.Status      = (int)CConstValue.InvoiceStatus.Pending;
                            refundInvoice.CreatedId   = CurrentUserId;
                            refundInvoice.CreatedDate = DateTime.Now;

                            var invoiceId = cRefundInvoice.Add(refundInvoice);
                            if (invoiceId > 0)
                            {
                                var refundInvoiceItems = new CInvoiceItem();
                                refundInvoiceItems.RefundItemsUpdate(original.InvoiceId, invoiceId, Convert.ToDecimal(RefundInfo1.GetRefundRate().Value), CurrentUserId);

                                var cCreditMemo = new CCreditMemo();
                                var creditMemo  = new CreditMemo();

                                creditMemo.CreditMemoType           = (int)CConstValue.CreditMemoType.Refund;
                                creditMemo.InvoiceId                = invoiceId; //Refund Invoice Id
                                creditMemo.OriginalCreditMemoAmount = 0;
                                creditMemo.CreatedId                = CurrentUserId;
                                creditMemo.CreatedDate              = DateTime.Now;
                                creditMemo.IsActive = false;

                                var creditMemoId = cCreditMemo.Add(creditMemo);
                                if (creditMemoId > 0)
                                {
                                    var cCreditMemoPayout = new CCreditMemoPayout();
                                    var creditMemoPayout  = new CreditMemoPayout();

                                    creditMemoPayout.CreditMemoId = creditMemoId;
                                    creditMemoPayout.Amount       = 0;
                                    creditMemoPayout.IsActive     = false;
                                    creditMemoPayout.CreatedId    = CurrentUserId;
                                    creditMemoPayout.CreatedDate  = DateTime.Now;

                                    var creditMemoPayoutId = cCreditMemoPayout.Add(creditMemoPayout);
                                    if (creditMemoPayoutId > 0)
                                    {
                                        var cRefund = new CRefund();
                                        var refund  = new Refund();

                                        refund.CreditMemoPayoutId = creditMemoPayoutId;
                                        refund.InvoiceId          = invoiceId;
                                        refund.RefundDate         = Convert.ToDateTime(RefundInfo1.RadActualDate().SelectedDate);
                                        refund.RefundRate         = Convert.ToDouble(RefundInfo1.GetRefundRate().Value);
                                        refund.RefundReason       = RefundInfo1.GetReason().Text;
                                        refund.IsActive           = false;
                                        refund.CreatedId          = CurrentUserId;
                                        refund.CreatedDate        = DateTime.Now;

                                        if (cRefund.Add(refund) > 0)
                                        {
                                            // save uploading file
                                            FileDownloadList1.SaveFile(refund.RefundId);

                                            RunClientScript("Close();");
                                        }
                                        ShowMessage("failed to update inqury (Add Refund Info)");
                                    }
                                    else
                                    {
                                        ShowMessage("failed to update inqury (Add CreditMemoPayout)");
                                    }
                                }
                                else
                                {
                                    ShowMessage("failed to update inqury (Add CreditMemo)");
                                }
                            }
                            else
                            {
                                ShowMessage("failed to update inqury (Add Refund Invoice)");
                            }
                        }
                        else
                        {
                            ShowMessage("failed to update inqury (Update Original Invoice)");
                        }
                    }
                    else
                    {
                        ShowMessage("failed to update inqury (Original Invoice is null)");
                    }
                }
                break;

            case "Close":
                RunClientScript("Close();");
                break;
            }
        }
示例#16
0
        protected void ToolbarButtonClick(object sender, RadToolBarEventArgs e)
        {
            if (e.Item.Text == "Save")
            {
                if (IsValid)
                {
                    if (!string.IsNullOrEmpty(ddlAgency.SelectedValue) && (tbCommissionRate.Value == 0 || tbCommissionRate.Value == null))
                    {
                        ShowMessage("Commision Rate should be written.");
                        return;
                    }

                    var cScholarship = new CScholarship();
                    if (ScholarshipId != null)
                    {
                        var scholarship = cScholarship.GetVwScholarship((int)ScholarshipId);
                        if (RadButtonAvailableScholarshipAmount.Checked)
                        {
                            if (scholarship.AvailableAmount == 0 || (double)scholarship.AvailableAmount < RadNumericTextBoxScholarshipAmount.Value)
                            {
                                ShowMessage("Scholarship Amount is bigger than availalble Amount.");
                                return;
                            }
                        }
                        else
                        {
                            if (scholarship.AvailableWeeks == 0 || (double)scholarship.AvailableWeeks < RadNumericTextBoxScholarshipWeeks.Value)
                            {
                                ShowMessage("Scholarship Weeks are bigger than availalble Weeks.");
                                return;
                            }
                        }
                    }

                    var cProgramReg = new CProgramRegistration();
                    var programReg  = new ProgramRegistration();

                    programReg.StudentId = Id;
                    programReg.ProgramId = Convert.ToInt32(ddlProgramName.SelectedValue);

                    programReg.StartDate = tbPrgStartDate.SelectedDate;
                    programReg.EndDate   = tbPrgEndDate.SelectedDate;
                    programReg.ProgramRegistrationType = 9;

                    if (!string.IsNullOrEmpty(ddlProgramWeeks.SelectedValue))
                    {
                        programReg.Weeks = Convert.ToInt32(ddlProgramWeeks.SelectedValue);
                    }

                    if (!string.IsNullOrEmpty(ddlPrgHours.SelectedValue))
                    {
                        programReg.HrsStatus = Convert.ToInt32(ddlPrgHours.SelectedValue);
                    }

                    programReg.CreatedId   = CurrentUserId;
                    programReg.CreatedDate = DateTime.Now;

                    var proRegId = cProgramReg.Add(programReg); //DB:ProgramRegistration

                    if (proRegId > 0)
                    {
                        var cInvoice = new CInvoice();
                        var invoice  = new Invoice();

                        invoice.ProgramRegistrationId = proRegId;
                        invoice.StudentId             = Id;
                        if (!string.IsNullOrEmpty(ddlAgency.SelectedValue))
                        {
                            invoice.AgencyId             = Convert.ToInt32(ddlAgency.SelectedValue);
                            invoice.IsAgencySeasonalRate = RadButtonAgencyRateSeasonal.Checked;
                            invoice.AgencyRate           = tbCommissionRate.Value;
                        }

                        if (ScholarshipId != null)
                        {
                            invoice.ScholarshipId = ScholarshipId;
                            if (RadButtonAvailableScholarshipAmount.Checked)
                            {
                                invoice.ScholarshipAmount = (decimal)RadNumericTextBoxScholarshipAmount.Value;
                            }
                            else
                            {
                                invoice.ScholarshipAmount = (decimal)RadNumericTextBoxScholarshipAmount.Value;
                                invoice.ScholarshipWeeks  = (int)RadNumericTextBoxScholarshipWeeks.Value;
                            }
                        }
                        invoice.PromotionId = PromotionId;

                        invoice.SiteLocationId = CurrentSiteLocationId;
                        invoice.InvoiceType    = (int)CConstValue.InvoiceType.General; //General Invoice(IN)


                        invoice.Status      = (int)CConstValue.InvoiceStatus.Pending; // Pending
                        invoice.CreatedId   = CurrentUserId;
                        invoice.CreatedDate = DateTime.Now;

                        var invoiceId = cInvoice.Add(invoice); //DB:Invoice

                        if (invoiceId > 0)
                        {
                            var cInvoiceItem = new CInvoiceItem();

                            foreach (GridDataItem item in _radGridInvoiceItems.Items)
                            {
                                var invoiceCoaItemId = (RadDropDownList)item.FindControl("ddlInvoiceItems");
                                var standardPrice    = (Label)item.FindControl("lblStandardPrice");
                                var studentPrice     = (Label)item.FindControl("lblStudentPrice");
                                var agencyPrice      = (Label)item.FindControl("lblAgencyPrice");

                                var invoiceItem = new InvoiceItem();
                                invoiceItem.InvoiceId = invoiceId;

                                invoiceItem.InvoiceCoaItemId = Convert.ToInt32(invoiceCoaItemId.SelectedValue);
                                invoiceItem.StandardPrice    = Convert.ToDecimal(standardPrice.Text.Replace("$", string.Empty));
                                invoiceItem.StudentPrice     = Convert.ToDecimal(studentPrice.Text.Replace("$", string.Empty));
                                invoiceItem.AgencyPrice      = Convert.ToDecimal(agencyPrice.Text.Replace("$", string.Empty));

                                invoiceItem.CreatedId   = CurrentUserId;
                                invoiceItem.CreatedDate = DateTime.Now;

                                cInvoiceItem.Add(invoiceItem);
                            }

                            // disable used scholarship
                            if (ScholarshipId != null)
                            {
                                var sScholarship = new CScholarship();
                                var scholarship  = sScholarship.Get((int)ScholarshipId);
                                scholarship.IsActive = true;
                                sScholarship.Update(scholarship);
                            }

                            RunClientScript("Close();");
                        }
                        else
                        {
                            ShowMessage("failed to update inqury (Add Invoice Items)");
                        }
                    }
                    else
                    {
                        ShowMessage("failed to update inqury (Invoice)");
                    }
                }
            }
            else
            {
                ShowMessage("Fill in data");
            }
        }
示例#17
0
        public void ValidateInvoiceItems()
        {
            if (ViewState["IsSaveChanged"] != null)
            {
                // init
                ViewState["IsSaveChanged"] = null;

                // ===========
                // validation
                // ===========
                var cInvoice = new CInvoice();
                var invoice  = cInvoice.Get(InvoiceId);

                var cInvoiceItem = new CInvoiceItem();
                var invoiceItem  = cInvoiceItem.GetInvoiceItems(InvoiceId);

                decimal calCommissionFee = 0;
                foreach (InvoiceItem item in invoiceItem)
                {
                    // direct Student
                    if (invoice.AgencyId == null)
                    {
                        if (item.AgencyPrice != 0)
                        {
                            // update price which isnot zero
                            item.AgencyPrice = 0;
                            cInvoiceItem.Update(item);
                        }
                    }
                    // from Agency
                    else
                    {
                        switch (item.InvoiceCoaItemId)
                        {
                        // tuition
                        case 1:
                            calCommissionFee = (decimal)item.AgencyPrice;
                            break;

                        // scholarship
                        case 2:
                        // promotion Credit
                        case 3:
                        // Advertising fee
                        case 4:
                        // Commision - Incentive
                        case 5:
                            calCommissionFee += (decimal)item.AgencyPrice;
                            break;


                        // Commission - Tuition
                        case 6:
                            var cAgency = new CAgency();
                            var agency  = cAgency.Get((int)invoice.AgencyId);
                            if (agency.CommissionRateBasic != null)
                            {
                                // update calculated commissionFee
                                item.AgencyPrice = calCommissionFee * ((decimal)agency.CommissionRateBasic / -100);
                                cInvoiceItem.Update(item);
                            }
                            break;
                        }
                    }

                    // get standardPrice
                    decimal maximumPrice = (decimal)(item.StudentPrice > item.AgencyPrice ?
                                                     (item.StudentPrice < 0 ? 0 : item.StudentPrice) : (item.AgencyPrice < 0 ? 0 : item.AgencyPrice));

                    decimal?tempStandardPrice = 0;
                    // tuition
                    if (item.InvoiceCoaItemId == 1)
                    {
                        if (item.StandardPrice > 0)
                        {
                            tempStandardPrice = item.StandardPrice;
                        }
                        else
                        {
                            tempStandardPrice = item.StandardPrice > maximumPrice ? item.StandardPrice : maximumPrice;
                        }
                    }
                    // others
                    else
                    {
                        tempStandardPrice = item.StandardPrice > maximumPrice ? item.StandardPrice : maximumPrice;
                    }

                    if (item.StandardPrice != tempStandardPrice)
                    {
                        item.StandardPrice = tempStandardPrice;
                        cInvoiceItem.Update(item);
                    }
                }
            }
        }
示例#18
0
        protected void ToolbarButtonClick(object sender, RadToolBarEventArgs e)
        {
            if (e.Item.Text == @"Save")
            {
                if (IsValid)
                {
                    if (!string.IsNullOrEmpty(ddlAgency.SelectedValue) && (tbCommissionRate.Value == 0 || tbCommissionRate.Value == null))
                    {
                        ShowMessage("Commision Rate should be written.");
                        return;
                    }

                    var programId        = Convert.ToInt32(ddlPackageProgram.SelectedValue.Split(',')[1]);
                    var packageProgramId = Convert.ToInt32(ddlPackageProgram.SelectedValue.Split(',')[0]);

                    var cProgramReg = new CProgramRegistration();
                    var programReg  = new ProgramRegistration();

                    programReg.StudentId        = Id;
                    programReg.ProgramId        = programId;
                    programReg.PackageProgramId = packageProgramId;

                    programReg.StartDate = tbPrgStartDate.SelectedDate;
                    programReg.EndDate   = tbPrgEndDate.SelectedDate;

                    programReg.ProgramRegistrationType = 9;

                    programReg.CreatedId   = CurrentUserId;
                    programReg.CreatedDate = DateTime.Now;

                    var proRegId = cProgramReg.Add(programReg); //DB:ProgramRegistration

                    if (proRegId > 0)
                    {
                        // add basic invoice first, then homestay or dormitory if exists.
                        var cInvoice = new CInvoice();
                        var invoice  = new Invoice();

                        invoice.ProgramRegistrationId = proRegId;
                        invoice.StudentId             = Id;
                        if (!string.IsNullOrEmpty(ddlAgency.SelectedValue))
                        {
                            invoice.AgencyId             = Convert.ToInt32(ddlAgency.SelectedValue);
                            invoice.IsAgencySeasonalRate = RadButtonAgencyRateSeasonal.Checked;
                            invoice.AgencyRate           = tbCommissionRate.Value;
                        }
                        invoice.SiteLocationId = CurrentSiteLocationId;
                        invoice.InvoiceType    = (int)CConstValue.InvoiceType.General;   //General Invoice(IN)
                        invoice.Status         = (int)CConstValue.InvoiceStatus.Pending; // Pending
                        invoice.CreatedId      = CurrentUserId;
                        invoice.CreatedDate    = DateTime.Now;

                        var invoiceId = cInvoice.Add(invoice); //DB:Invoice

                        if (invoiceId > 0)
                        {
                            var invoiceItems          = new List <InvoiceItem>();
                            var homestayInvoiceItems  = new List <InvoiceItem>();
                            var dormitoryInvoiceItems = new List <InvoiceItem>();
                            var airportInvoiceItems   = new List <InvoiceItem>();

                            var cInvoiceItem = new CInvoiceItem();

                            foreach (GridDataItem item in _radGridInvoiceItems.Items)
                            {
                                var invoiceCoaItemId = (RadDropDownList)item.FindControl("ddlInvoiceItems");
                                var standardPrice    = (Label)item.FindControl("lblStandardPrice");
                                var studentPrice     = (Label)item.FindControl("lblStudentPrice");
                                var agencyPrice      = (Label)item.FindControl("lblAgencyPrice");

                                var invoiceItem = new InvoiceItem();
                                invoiceItem.InvoiceId = invoiceId;

                                invoiceItem.InvoiceCoaItemId = Convert.ToInt32(invoiceCoaItemId.SelectedValue);
                                invoiceItem.StandardPrice    = Convert.ToDecimal(standardPrice.Text.Replace("$", string.Empty));
                                invoiceItem.StudentPrice     = Convert.ToDecimal(studentPrice.Text.Replace("$", string.Empty));
                                invoiceItem.AgencyPrice      = Convert.ToDecimal(agencyPrice.Text.Replace("$", string.Empty));

                                invoiceItem.CreatedId   = CurrentUserId;
                                invoiceItem.CreatedDate = DateTime.Now;

                                switch (invoiceItem.InvoiceCoaItemId)
                                {
                                case (int)CConstValue.InvoiceCoaItemForHomestay.HomestayBasic:
                                case (int)CConstValue.InvoiceCoaItemForHomestay.HomestayBasicDiscount:
                                case (int)CConstValue.InvoiceCoaItemForHomestay.HomestayPlacement:
                                case (int)CConstValue.InvoiceCoaItemForHomestay.HomestayPlacementDiscount:
                                case (int)CConstValue.InvoiceCoaItemForHomestay.HomestayInternetGuarantee:
                                case (int)CConstValue.InvoiceCoaItemForHomestay.HomestayOtherDiscount:
                                    homestayInvoiceItems.Add(invoiceItem);
                                    break;

                                case (int)CConstValue.InvoiceCoaItemForDormitory.DormitoryBasic:
                                case (int)CConstValue.InvoiceCoaItemForDormitory.DormitoryBasicDiscount:
                                case (int)CConstValue.InvoiceCoaItemForDormitory.DormitoryPlacement:
                                case (int)CConstValue.InvoiceCoaItemForDormitory.DormitoryPlacementDiscount:
                                case (int)CConstValue.InvoiceCoaItemForDormitory.DormitoryKeyDeposit:
                                case (int)CConstValue.InvoiceCoaItemForDormitory.DormitoryKeyDepositDiscount:
                                    dormitoryInvoiceItems.Add(invoiceItem);
                                    break;

                                case (int)CConstValue.InvoiceCoaItem.AirportPickup:
                                case (int)CConstValue.InvoiceCoaItem.AirportPickupDiscount:
                                case (int)CConstValue.InvoiceCoaItem.AirportDropoff:
                                case (int)CConstValue.InvoiceCoaItem.AirportDropoffDiscount:
                                case (int)CConstValue.InvoiceCoaItem.AirportPickupAndDropoff:
                                case (int)CConstValue.InvoiceCoaItem.AirportPickupAndDropoffDiscount:
                                    airportInvoiceItems.Add(invoiceItem);
                                    break;

                                default:
                                    invoiceItems.Add(invoiceItem);
                                    break;
                                }
                            }

                            // add invoiceItems except for homestay and dormitory
                            if (cInvoiceItem.Add(invoiceItems) == false)
                            {
                                ShowMessage("Error : add invoiceItem");
                            }

                            // add homestay if exist.
                            if (homestayInvoiceItems.Count > 0)
                            {
                                var newHomestayRegistrationId = new CHomestayStudentRequest().Add(new HomestayStudentBasic()
                                {
                                    HomestayStudentStatus = 0, // Pending
                                    StudentId             = Id,
                                    PlacedUserId          = 0,
                                    CreatedUserId         = CurrentUserId,
                                    CreatedDate           = DateTime.Now
                                });

                                if (newHomestayRegistrationId > 0)
                                {
                                    var invoiceForHomestay = new Invoice();
                                    invoiceForHomestay.HomestayRegistrationId = newHomestayRegistrationId;
                                    invoiceForHomestay.StudentId = Id;
                                    if (!string.IsNullOrEmpty(ddlAgency.SelectedValue))
                                    {
                                        invoiceForHomestay.AgencyId             = Convert.ToInt32(ddlAgency.SelectedValue);
                                        invoiceForHomestay.IsAgencySeasonalRate = RadButtonAgencyRateSeasonal.Checked;
                                        invoiceForHomestay.AgencyRate           = tbCommissionRate.Value;
                                    }
                                    invoiceForHomestay.SiteLocationId = CurrentSiteLocationId;
                                    invoiceForHomestay.InvoiceType    = (int)CConstValue.InvoiceType.Homestay;
                                    invoiceForHomestay.Status         = (int)CConstValue.InvoiceStatus.Pending;
                                    invoiceForHomestay.CreatedId      = CurrentUserId;
                                    invoiceForHomestay.CreatedDate    = DateTime.Now;

                                    var invoiceForHomestayId = cInvoice.Add(invoiceForHomestay);
                                    if (invoiceForHomestayId > 0)
                                    {
                                        foreach (var h in homestayInvoiceItems)
                                        {
                                            h.InvoiceId = invoiceForHomestayId;
                                        }
                                        foreach (var a in airportInvoiceItems)
                                        {
                                            a.InvoiceId = invoiceForHomestayId;
                                        }

                                        // merge between homestay Items and airport Items
                                        homestayInvoiceItems.AddRange(airportInvoiceItems);

                                        if (cInvoiceItem.Add(homestayInvoiceItems) == false)
                                        {
                                            ShowMessage("Error : add invoiceHomestayItem");
                                        }
                                    }
                                    else
                                    {
                                        ShowMessage("Error : add Homestay");
                                    }
                                }
                                else
                                {
                                    ShowMessage("Error : add Homestay registration");
                                }
                            }

                            // add dormitory if exist.
                            if (dormitoryInvoiceItems.Count > 0)
                            {
                                var newDormitoryRegistrationId = new CDormitoryRegistrations().Add(new DormitoryRegistration()
                                {
                                    DormitoryStudentStatus = 0, // Pending
                                    StudentId    = Id,
                                    PlacedUserId = 0,
                                    CreatedId    = CurrentUserId,
                                    CreatedDate  = DateTime.Now
                                });

                                if (newDormitoryRegistrationId > 0)
                                {
                                    var invoiceForDormitory = new Invoice();
                                    invoiceForDormitory.DormitoryRegistrationId = newDormitoryRegistrationId;
                                    invoiceForDormitory.StudentId = Id;
                                    if (!string.IsNullOrEmpty(ddlAgency.SelectedValue))
                                    {
                                        invoiceForDormitory.AgencyId             = Convert.ToInt32(ddlAgency.SelectedValue);
                                        invoiceForDormitory.IsAgencySeasonalRate = RadButtonAgencyRateSeasonal.Checked;
                                        invoiceForDormitory.AgencyRate           = tbCommissionRate.Value;
                                    }
                                    invoiceForDormitory.SiteLocationId = CurrentSiteLocationId;
                                    invoiceForDormitory.InvoiceType    = (int)CConstValue.InvoiceType.Dormitory;
                                    invoiceForDormitory.Status         = (int)CConstValue.InvoiceStatus.Pending;
                                    invoiceForDormitory.CreatedId      = CurrentUserId;
                                    invoiceForDormitory.CreatedDate    = DateTime.Now;

                                    var invoiceForDormitoryId = cInvoice.Add(invoiceForDormitory);
                                    if (invoiceForDormitoryId > 0)
                                    {
                                        foreach (var h in dormitoryInvoiceItems)
                                        {
                                            h.InvoiceId = invoiceForDormitoryId;
                                        }
                                        foreach (var a in airportInvoiceItems)
                                        {
                                            a.InvoiceId = invoiceForDormitoryId;
                                        }

                                        // merge between dormitory Items and airport Items
                                        dormitoryInvoiceItems.AddRange(airportInvoiceItems);

                                        if (cInvoiceItem.Add(dormitoryInvoiceItems) == false)
                                        {
                                            ShowMessage("Error : add invoiceDormitoryItem");
                                        }
                                    }
                                    else
                                    {
                                        ShowMessage("Error : add Dormitory");
                                    }
                                }
                                else
                                {
                                    ShowMessage("Error : add Dormitory registration");
                                }
                            }

                            RunClientScript("Close();");
                        }
                        else
                        {
                            ShowMessage("failed to update inqury (Invoice)");
                        }
                    }
                    else
                    {
                        ShowMessage("failed to update inqury (Program Registragion)");
                    }
                }
            }
        }
示例#19
0
        public RConfirmationOfEnrollment(int invoiceId)
        {
            //
            // Required for telerik Reporting designer support
            //
            InitializeComponent();

            var invoice = new CInvoice().Get(invoiceId);

            if (invoice?.ProgramRegistrationId == null)
            {
                return;
            }

            var programRegistration = new CProgramRegistration().Get((int)invoice.ProgramRegistrationId);

            if (programRegistration == null)
            {
                return;
            }

            var cStudent = new CStudent();
            var student  = cStudent.Get((int)invoice.StudentId);

            if (student == null)
            {
                return;
            }

            var studentGender = (student.Gender == false ? "Mr. " : "Ms. ");

            textBoxDate.Value = DateTime.Today.ToString("MM-dd-yy");
            // id
            textBoxId.Value = "ID : " + student.StudentNo;
            // letter of acceptance
            textBoxConfirmationOfEnrollment.Value = $@"Confirmation Of Enrollment : {studentGender + cStudent.GetStudentFullName(student)}";
            // date of birth
            textBoxDateOfBirth.Value = $@"(Date of Birth: {student.DOB?.ToString("MM-dd-yy")})";

            var programType = "Part-time";
            var hours       = string.Empty;
            var weeks       = string.Empty;

            if (programRegistration.HrsStatus != null)
            {
                if (programRegistration.HrsStatus >= 20)
                {
                    programType = "Full-time";
                }

                hours = $"({programRegistration.HrsStatus} hours per week)";
            }

            if (programRegistration.Weeks != null)
            {
                weeks = programRegistration.Weeks + " weeks";
            }

            var program      = new CProgram().Get(programRegistration.ProgramId);
            var siteLocation = new CSiteLocation().Get(student.SiteLocationId);
            var site         = new CSite().Get(siteLocation.SiteId);

            // this letter
            htmlTextBoxThisLetter.Value = $@"This letter certifies that {studentGender + cStudent.GetStudentFullName(student)} has been accepted for {programType} studies {hours} of {program?.ProgramFullName} at the {siteLocation.Name} campus of {site.Abbreviation}. The period of enrollment is {weeks} beginning {programRegistration.StartDate?.ToString("MM-dd-yy")} and ending {programRegistration.EndDate?.ToString("MM-dd-yy")}.<br><br>
During the student's enrollment {studentGender + cStudent.GetStudentFullName(student)} attended classes.<br>
During the {weeks} of study, {studentGender + cStudent.GetStudentFullName(student)}'s attendance was above 85%.<br><br><br>
If you should have any questions regarding the enrollment of {studentGender + student.FirstName} at our college, please do
not hesitate to contact our campus director.";

            switch (siteLocation.SiteId)
            {
            // CAC
            case 2:
                textBoxName.Value     = "Christine Jang";
                textBoxJobTitle.Value = "Site Administrator";
                break;

            default:
                textBoxName.Value     = string.Empty;
                textBoxJobTitle.Value = string.Empty;
                break;
            }

            try
            {
                var logoPath = new CGlobal().GetLogoImagePath((int)invoice.SiteLocationId, CConstValue.ImageType.Logo);
                if (logoPath != string.Empty)
                {
                    pictureBoxCompanyLogo.Value = Image.FromFile(logoPath);
                }
            }
            catch (Exception ex)
            {
                Debug.Print(ex.Message);
            }

            try
            {
                var signPath = new CGlobal().GetLogoImagePath((int)invoice.SiteLocationId, CConstValue.ImageType.Sign);
                if (signPath != string.Empty)
                {
                    pictureBoxSign.Value = Image.FromFile(signPath);
                }
            }
            catch (Exception ex)
            {
                Debug.Print(ex.Message);
            }
        }
示例#20
0
        protected void ToolbarButtonClick(object sender, RadToolBarEventArgs e)
        {
            switch (e.Item.Text)
            {
            case "Request":
                if (IsValid)
                {
                    var invoiceInfo = new CInvoice(InvoiceId.ToString());
                    if (invoiceInfo != null)
                    {
                        if (tbProgramChangeDate.SelectedDate < invoiceInfo.StartDate &&
                            invoiceInfo.AgencyNet <= invoiceInfo.Balance)
                        {
                            //Before Program Start and UnPaid
                            var newInvoice = NewProgramInvoiceCreate();

                            if (newInvoice > 0)
                            {
                                //var cBCTinfo = new CBCT();
                                //var BCTinfo = new BCT();

                                //BCTinfo.InvoiceId = Convert.ToInt32(hfInvoiceId.Value);
                                //BCTinfo.RequestDate = Convert.ToDateTime(tbRequestDate.SelectedDate);
                                //BCTinfo.ActualBCTdate = Convert.ToDateTime(tbProgramChangeDate.SelectedDate);

                                //BCTinfo.TransferTotalDaysOfProgram = Convert.ToInt32(tbTotalDaysOfProgram.Value);
                                //BCTinfo.TransferTotalDayTaken = Convert.ToInt32(tbTotalTakenDays.Value);
                                //BCTinfo.TransferDays = Convert.ToInt32(tbCancelDays.Value);

                                //BCTinfo.ProgramChangeInvoiceId = newInvoice;

                                //BCTinfo.CreatedId = CurrentUserId;

                                //BCTinfo.Reason = tbProgramChangeReason.Text;

                                //BCTinfo.ApprovalStatus = (int)CConstValue.ApprovalStatus.Approved;
                                ////payout status >Interface:0 Requested:2 Progress:3 Approved:99 Reject:98 Revise:97
                                //BCTinfo.ApprovalDate = DateTime.Now;
                                //BCTinfo.ApprovalId = CurrentUserId;

                                //var BCTid = cBCTinfo.Add(BCTinfo, CConstValue.BctTypeProgramChange);

                                //if (BCTid > 0)
                                //{
                                //    var cInvoice = new CInvoice();
                                //    var cancelInvoice = cInvoice.Get(Convert.ToInt32(hfInvoiceId.Value));
                                //    cancelInvoice.Status = 5; //Cancelled_P (Program Change)
                                //    cancelInvoice.UpdatedId = CurrentUserId;

                                //    if (cInvoice.Update(cancelInvoice))
                                //    {
                                //        var cProgRegInfo = new CProgramRegistration();
                                //        var progRegInfo = cProgRegInfo.Get(Convert.ToInt32(cancelInvoice.ProgramRegistrationId));

                                //        progRegInfo.IsCancel = true;
                                //        progRegInfo.CancelDate = DateTime.Now;

                                //        if (cProgRegInfo.Update(progRegInfo)) // Program registration info modify to Cancel status
                                //        {
                                //            RunClientScript("Close();");
                                //        }
                                //        else
                                //        {
                                //            ShowMessage("failed to update inqury (BCT(Program Change) Program Status)");
                                //        }
                                //    }
                                //    else
                                //    {
                                //        ShowMessage("failed to update inqury (BCT(Program Change) Invoice Cancelled Update)");
                                //    }
                                //}
                                //else
                                //{
                                //    ShowMessage("failed to update inqury (BCT(Program Change))");
                                //}
                            }
                        }
                        else if (tbProgramChangeDate.SelectedDate < invoiceInfo.StartDate && invoiceInfo.Balance == 0)
                        {
                            //Before Program start and Paid
                            if (RefundLogic(100, 100))
                            {
                                RunClientScript("Close();");
                            }
                            else
                            {
                                ShowMessage("failed to update inqury (BCT(Program Change) Refund Request)");
                            }
                        }
                        else if (tbProgramChangeDate.SelectedDate >= invoiceInfo.StartDate && invoiceInfo.Balance == 0)
                        {
                            //After Program start and Paid
                            if (RefundLogic(Convert.ToInt32(tbTotalDaysOfProgram.Value), Convert.ToInt32(tbCancelDays.Value)))
                            {
                                RunClientScript("Close();");
                            }
                            else
                            {
                                ShowMessage("failed to update inqury (BCT(Program Change) Refund Request)");
                            }
                        }
                    }
                }
                break;

            case "Close":
                RunClientScript("Close();");
                break;
            }
        }
示例#21
0
        protected void ToolbarButtonClick(object sender, RadToolBarEventArgs e)
        {
            switch (e.Item.Text)
            {
            case "Request":
                if (IsValid)
                {
                    var cOriginalInvoice = new CInvoice();
                    var original         = cOriginalInvoice.Get(InvoiceId);

                    if (original != null)
                    {
                        original.Status = (int)CConstValue.InvoiceStatus.Invoiced_Hold;     //Invoiced(Hold)
                        if (cOriginalInvoice.Update(original))
                        {
                            var originalInvoiceId = original.InvoiceId;

                            var cTransferInvoice = new CInvoice();
                            var transferInvoice  = new Invoice();

                            transferInvoice.OriginalInvoiceId = originalInvoiceId;
                            transferInvoice.InvoiceType       = (int)CConstValue.InvoiceType.Refund_TF; //Transfer Invoice

                            transferInvoice.StudentId              = original.StudentId;
                            transferInvoice.AgencyId               = original.AgencyId;
                            transferInvoice.ProgramRegistrationId  = original.ProgramRegistrationId;
                            transferInvoice.HomestayRegistrationId = original.HomestayRegistrationId;
                            transferInvoice.ScholarshipId          = original.ScholarshipId;
                            transferInvoice.PromotionId            = original.PromotionId;
                            transferInvoice.SiteLocationId         = original.SiteLocationId;

                            transferInvoice.IsFinancialGurantee = original.IsFinancialGurantee;

                            transferInvoice.Status      = (int)CConstValue.InvoiceStatus.Pending; // Pending
                            transferInvoice.CreatedId   = CurrentUserId;
                            transferInvoice.CreatedDate = DateTime.Now;

                            var invoiceId = cTransferInvoice.Add(transferInvoice);

                            if (invoiceId > 0)
                            {
                                var transferInvoiceItems = new CInvoiceItem();

                                //if (transferInvoiceItems.TransferCancelItemsUpdate(originalInvoiceId, invoiceId, Convert.ToInt32(tbTotalDaysOfProgram.Value), Convert.ToInt32(tbTransferDays.Value), CurrentUserId))
                                //{
                                //    var refundAmt = transferInvoiceItems.TotalAmount(invoiceId);

                                //    var cCreditMemo = new CCreditMemo();
                                //    var creditMemo = new CreditMemo();

                                //    creditMemo.CreditMemoType = (int)CConstValue.CreditType.Refund; //Transfer
                                //    creditMemo.InvoiceId = invoiceId; // Transfer Invoice Id
                                //    creditMemo.OriginalCreditMemoAmount = Math.Abs(refundAmt);
                                //    creditMemo.CreatedId = CurrentUserId;
                                //    creditMemo.CreatedDate = DateTime.Now;
                                //    creditMemo.IsActive = false;

                                //    var creditMemoId = cCreditMemo.Add(creditMemo);

                                //    if (creditMemoId > 0)
                                //    {
                                //        //var cBCTinfo = new CBCT();
                                //        //var BCTinfo = new BCT();

                                //        //BCTinfo.CreditMemoId = creditMemoId;
                                //        //BCTinfo.InvoiceId = invoiceId;
                                //        //BCTinfo.RequestDate = Convert.ToDateTime(tbRequestDate.SelectedDate);
                                //        //BCTinfo.ActualBCTdate = Convert.ToDateTime(tbTransferDate.SelectedDate);
                                //        //BCTinfo.BCTamount = Math.Abs(refundAmt);
                                //        //BCTinfo.CreatedId = CurrentUserId;

                                //        //BCTinfo.ApprovalStatus = (int)CConstValue.ApprovalStatus.Requested;
                                //        ////payout status > Requested:2 Progress:3 Approved:99 Reject:98 Revise:97
                                //        //BCTinfo.Reason = tbTransferReason.Text;

                                //        //BCTinfo.TransferToDepartmentId = Convert.ToInt32(ddlDepartment.SelectedValue);

                                //        //BCTinfo.TransferDays = Convert.ToInt32(tbTransferDays.Value);
                                //        //BCTinfo.TransferTotalDayTaken = Convert.ToInt32(tbTotalTakenDays.Value);
                                //        //BCTinfo.TransferTotalDaysOfProgram = Convert.ToInt32(tbTotalDaysOfProgram.Value);
                                //        //var BCTid = cBCTinfo.Add(BCTinfo, CConstValue.BctTypeTransfer);
                                //        //if (BCTid > 0)
                                //        //{
                                //        //    var approval = new CApproval();
                                //        //    if (approval.ApproveRequstCreate(CConstValue.ApprovalBct, CurrentUserId, BCTid) > 0)
                                //        //    {
                                //        //        RunClientScript("Close();");
                                //        //    }
                                //        //    else
                                //        //    {
                                //        //        ShowMessage("failed to update inqury (BCT(Transfer) ApprovalHistory)");
                                //        //    }
                                //        //}
                                //        //else
                                //        //{
                                //        //    ShowMessage("failed to update inqury (BCT(Transfer))");
                                //        //}
                                //    }
                                //    else
                                //    {
                                //        ShowMessage("failed to update inqury (Credit Memo)");
                                //    }
                                //}
                                //else
                                //{
                                //    ShowMessage("failed to update inqury (Invoice Items)");
                                //}
                            }
                            else
                            {
                                ShowMessage("failed to update inqury (transfer Invoice)");
                            }
                        }
                        else
                        {
                            ShowMessage("failed to update inqury (Update Original Invoice)");
                        }
                    }
                    else
                    {
                        ShowMessage("failed to update inqury (Original Invoice is null)");
                    }
                }
                break;

            case "Close":
                RunClientScript("Close();");
                break;
            }
        }
示例#22
0
        protected void RadToolBarStudentContract_OnButtonClick(object sender, RadToolBarEventArgs e)
        {
            switch (e.Item.Text)
            {
            case "New Program":
                if (RadGridStudentList.SelectedValue != null)
                {
                    RunClientScript("ShowRegProgramNewWindow(" + RadGridStudentList.SelectedValue + ");");
                }
                break;

            case "New Package":
                if (RadGridStudentList.SelectedValue != null)
                {
                    RunClientScript("ShowRegPackageProgramNewWindow(" + RadGridStudentList.SelectedValue + ");");
                }
                break;

            case "New Manual Invoice":
                if (RadGridStudentList.SelectedValue != null)
                {
                    var cInvoice = new CInvoice();
                    var invoice  = new Erp2016.Lib.Invoice
                    {
                        StudentId      = Convert.ToInt32(RadGridStudentList.SelectedValue),
                        SiteLocationId = CurrentSiteLocationId,
                        InvoiceType    = (int)CConstValue.InvoiceType.Manual,    // manual invoice,
                        Status         = (int)CConstValue.InvoiceStatus.Pending, // pending
                        CreatedId      = CurrentUserId,
                        CreatedDate    = DateTime.Now
                    };

                    if (cInvoice.Add(invoice) > 0)
                    {
                        ShowMessage("Manual Invoice has been created.");
                    }
                    else
                    {
                        ShowMessage("Failed to insert inqury");
                    }

                    GetStudentContract();
                }
                break;

            case "New Homestay":
                if (RadGridStudentList.SelectedValue != null)
                {
                    RunClientScript("ShowNewHomestayNewWindow(0," + RadGridStudentList.SelectedValue + ",0);");
                }
                break;

            case "New Dormitory":
                if (RadGridStudentList.SelectedValue != null)
                {
                    RunClientScript("ShowNewDormitoryNewWindow(0," + RadGridStudentList.SelectedValue + ",0);");      // Modify Dormitory Request
                }
                break;

            case "View Invoice":
                if (RadGridStudentContract.SelectedValue != null)
                {
                    RunClientScript("ShowInvoiceWindow(" + RadGridStudentContract.SelectedValue + ");");
                }
                break;

            case "Refund":
                if (RadGridStudentContract.SelectedValue != null)
                {
                    RunClientScript("ShowRefundWindow(" + RadGridStudentContract.SelectedValue + ");");
                }
                break;

            case "Transfer":
                if (RadGridStudentContract.SelectedValue != null)
                {
                    RunClientScript("ShowTransferWindow(" + RadGridStudentContract.SelectedValue + ");");
                }
                break;

            case "Break":
                if (RadGridStudentContract.SelectedValue != null)
                {
                    RunClientScript("ShowBreakWindow(" + RadGridStudentContract.SelectedValue + ");");
                }
                break;

            case "Cancel":
                if (RadGridStudentContract.SelectedValue != null)
                {
                    RunClientScript("ShowCancelWindow(" + RadGridStudentContract.SelectedValue + ");");
                }
                break;

            case "Program Change":
                if (RadGridStudentContract.SelectedValue != null)
                {
                    RunClientScript("ShowProgramChangeWindow(" + RadGridStudentContract.SelectedValue + ");");
                }
                break;

            case "Schedule Change":
                if (RadGridStudentContract.SelectedValue != null)
                {
                    RunClientScript("ShowScheduleChangeWindow(" + RadGridStudentContract.SelectedValue + ");");
                }
                break;

            // Schools
            case "Letter Of Acceptance":
                if (RadGridStudentContract.SelectedValue != null)
                {
                    RunClientScript("ShowReportPop('" + RadGridStudentContract.SelectedValue + "', '" + (int)CConstValue.Report.LetterOfAcceptance + "' );");
                }
                break;

            case "Letter Of Acceptance in table":
                if (RadGridStudentContract.SelectedValue != null)
                {
                    RunClientScript("ShowReportPop('" + RadGridStudentContract.SelectedValue + "', '" + (int)CConstValue.Report.LetterOfAcceptanceInTable + "' );");
                }
                break;

            case "Student Contract":
                if (RadGridStudentContract.SelectedValue != null)
                {
                    RunClientScript("ShowReportPop('" + RadGridStudentContract.SelectedValue + "', '" + (int)CConstValue.Report.StudentContract + "' );");
                }
                break;

            case "Orientation Form":
                if (RadGridStudentContract.SelectedValue != null)
                {
                    RunClientScript("ShowReportPop('" + RadGridStudentContract.SelectedValue + "', '" + (int)CConstValue.Report.OrientationForm + "' );");
                }
                break;

            case "Confirmation Of Completion Letter":
                if (RadGridStudentContract.SelectedValue != null)
                {
                    RunClientScript("ShowReportPop('" + RadGridStudentContract.SelectedValue + "', '" + (int)CConstValue.Report.ConfirmationOfCompletionLetter + "' );");
                }
                break;

            case "Confirmation Of Enrollment":
                if (RadGridStudentContract.SelectedValue != null)
                {
                    RunClientScript("ShowReportPop('" + RadGridStudentContract.SelectedValue + "', '" + (int)CConstValue.Report.ConfirmationOfEnrollment + "' );");
                }
                break;

            // Academy
            case "Certification":
                if (RadGridStudentContract.SelectedValue != null)
                {
                    RunClientScript("ShowReportPop('" + RadGridStudentContract.SelectedValue + "', '" + (int)CConstValue.Report.Certification + "' );");
                }
                break;
            }
        }
示例#23
0
        protected int NewProgramInvoiceCreate()
        {
            var cProgRegInfo = new CProgramRegistration();
            var programReg   = new ProgramRegistration();

            programReg.StudentId = 0;
            programReg.ProgramId = Convert.ToInt32(ddlProgramName.SelectedValue);

            programReg.StartDate = tbPrgStartDate.SelectedDate;
            programReg.EndDate   = tbPrgEndDate.SelectedDate;

            programReg.Weeks     = Convert.ToInt32(ddlProgramWeeks.SelectedValue);
            programReg.HrsStatus = Convert.ToInt32(ddlPrgHours.SelectedValue);

            var proRegId = cProgRegInfo.Add(programReg); //DB:ProgramRegistration

            if (proRegId > 0)
            {
                var cInvoice = new CInvoice();
                var invoice  = new Invoice();

                invoice.ProgramRegistrationId = proRegId;
                invoice.StudentId             = 0;
                invoice.AgencyId = Convert.ToInt32(ddlAgency.SelectedValue);
                //invoice.ScholarshipId = Scholarship;
                invoice.SiteLocationId = CurrentSiteLocationId;

                invoice.InvoiceType = (int)CConstValue.InvoiceType.General;   //General Invoice(IN)

                invoice.Status      = (int)CConstValue.InvoiceStatus.Pending; // Pending
                invoice.CreatedId   = CurrentUserId;
                invoice.CreatedDate = DateTime.Now;

                var invoiceId = cInvoice.Add(invoice); //DB:Invoice

                //if (invoiceId > 0)
                //{
                //    var cInvoiceItem = new CInvoiceItem();
                //    var invoiceItem = new InvoiceItem();

                //    invoiceItem.InvoiceId = invoiceId;
                //    invoiceItem.InvoiceCoaItemId = 1; //1:Tuition
                //    invoiceItem.StandardPrice = Convert.ToDecimal(tbPrgStandardTuition.Value);
                //    invoiceItem.StudentPrice = Convert.ToDecimal(tbPrgTuition.Value);
                //    invoiceItem.AgencyPrice = Convert.ToDecimal(tbPrgTuition.Value);

                //    invoiceItem.CreatedId = CurrentUserId;
                //    invoiceItem.CreatedDate = DateTime.Now;

                //    if (cInvoiceItem.Add(invoiceItem) > 0) //DB:InvoiceItem(Tuition Item)
                //    {
                //        var standardTuitionId = Convert.ToInt32(ViewState["ProgramTuitionId"]);
                //        var commission = Convert.ToDecimal(tbPrgTuition.Value) * Convert.ToDecimal(tbCommissionRate.Value) / 100;

                //        if (commission > 0)
                //        {
                //            cInvoiceItem.CommissionAdd(invoiceId, commission, CurrentUserId); //DB:InvoiceItem(Commission-Tuition)
                //        }

                //        if (cInvoiceItem.ItemsAdd(invoiceId, standardTuitionId, CurrentUserId))
                //        //DB:InvoiceItem(Other Items)
                //        {
                //            return invoiceId;
                //        }
                //        ShowMessage("failed to update inqury (Add Invoice Items)");
                //    }
                //    else
                //    {
                //        ShowMessage("failed to update inqury (Add Invoice Items)");
                //    }
                //}
                //else
                //{
                //    ShowMessage("failed to update inqury (Invoice)");
                //}
            }
            else
            {
                ShowMessage("failed to update inqury (Program Registragion)");
            }
            return(0);
        }
示例#24
0
        protected void ToolbarButtonClick(object sender, RadToolBarEventArgs e)
        {
            switch (e.Item.Text)
            {
            case "Request":
                if (IsValid)
                {
                    var cInvoice = new CInvoice();
                    var original = cInvoice.Get(InvoiceId);
                    if (original != null)
                    {
                        original.Status    = (int)CConstValue.InvoiceStatus.Cancelled_CC;
                        original.UpdatedId = CurrentUserId;

                        if (cInvoice.Update(original))
                        {
                            var cCancel = new CCancel();
                            var cancel  = new Cancel();

                            cancel.InvoiceId = original.InvoiceId;
                            cancel.ApplyDate = RadDatePickerApply.SelectedDate.Value;
                            cancel.Reason    = RadTextBoxReason.Text;
                            cancel.IsActive  = true;
                            cancel.CreatedId = CurrentUserId;

                            int cancelId = cCancel.Add(cancel);
                            if (cancelId > 0)
                            {
                                // save uploading file
                                FileDownloadList1.SaveFile(cancelId);

                                // Program
                                if (original.ProgramRegistrationId != null)
                                {
                                    var cProgramRegiInfo = new CProgramRegistration();
                                    var programRegiInfo  = cProgramRegiInfo.Get(Convert.ToInt32(original.ProgramRegistrationId));
                                    programRegiInfo.UpdatedId               = CurrentUserId;
                                    programRegiInfo.UpdatedDate             = DateTime.Now;
                                    programRegiInfo.ProgramRegistrationType = 12;     // cancel

                                    cProgramRegiInfo.Update(programRegiInfo);
                                }
                                // Homestay
                                else if (original.HomestayRegistrationId != null)
                                {
                                    var cHomestayStudentRequest = new CHomestayStudentRequest();
                                    var homestayStudentRequest  = cHomestayStudentRequest.GetHomestayStudentRequest(Convert.ToInt32(original.HomestayRegistrationId));
                                    homestayStudentRequest.UpdateUserId          = CurrentUserId;
                                    homestayStudentRequest.UpdatedDate           = DateTime.Now;
                                    homestayStudentRequest.HomestayStudentStatus = 1;     // cancel


                                    cHomestayStudentRequest.Update(homestayStudentRequest);
                                }
                                // Dormitory
                                else if (original.DormitoryRegistrationId != null)
                                {
                                    var cDormitoryStudentRequest = new CDormitoryRegistrations();
                                    var dormitoryStudentRequest  = cDormitoryStudentRequest.GetDormitoryStudentRequest(Convert.ToInt32(original.DormitoryRegistrationId));
                                    dormitoryStudentRequest.DormitoryStudentStatus = 1;     // cancel
                                    dormitoryStudentRequest.UpdatedId   = CurrentUserId;
                                    dormitoryStudentRequest.UpdatedDate = DateTime.Now;

                                    cDormitoryStudentRequest.Update(dormitoryStudentRequest);
                                }

                                if (original.ScholarshipId != null)
                                {
                                    var cScholarship = new CScholarship();
                                    var scholarship  = cScholarship.Get((int)original.ScholarshipId);
                                    if (scholarship != null)
                                    {
                                        scholarship.IsActive = true;
                                        cScholarship.Update(scholarship);
                                    }
                                }

                                RunClientScript("Close();");
                            }
                            else
                            {
                                ShowMessage("failed to update inqury (Add Cancel)");
                            }
                        }
                        else
                        {
                            ShowMessage("failed to update inqury (Update Original Invoice)");
                        }
                    }
                    else
                    {
                        ShowMessage("failed to update inqury (Original Invoice is null)");
                    }
                }
                break;

            case "Close":
                RunClientScript("Close();");
                break;
            }
        }
示例#25
0
        public RConfirmationOfCompletionLetter(int invoiceId)
        {
            //
            // Required for telerik Reporting designer support
            //
            InitializeComponent();

            var invoice = new CInvoice().Get(invoiceId);

            if (invoice?.ProgramRegistrationId == null)
            {
                return;
            }

            var programRegistration = new CProgramRegistration().Get((int)invoice.ProgramRegistrationId);

            if (programRegistration == null)
            {
                return;
            }

            var cStudent = new CStudent();
            var student  = cStudent.Get((int)invoice.StudentId);

            if (student == null)
            {
                return;
            }

            var program      = new CProgram().Get(programRegistration.ProgramId);
            var siteLocation = new CSiteLocation().Get(student.SiteLocationId);
            var site         = new CSite().Get(siteLocation.SiteId);

            htmlTextBoxSubTitle.Value    = $@"{site.Name} - {siteLocation.Name} - Canada";
            htmlTextBoxStudentId.Value   = $@"Student ID : {student.StudentNo}";
            htmlTextBoxDateOfIssue.Value = $@"Date of Issue : {DateTime.Today}";

            htmlTextBoxThisIs.Value = $@"This is to confirm that the following student has successfully completed their studies at {site.Name}.";

            htmlTextBoxFamilyName.Value  = $@"FAMILY NAME : {student.LastName1}";
            htmlTextBoxFirstName.Value   = $@"FIRST NAME : {student.FirstName}";
            htmlTextBoxDateOfBirth.Value = $@"DATE OF BIRTH : {student.DOB?.ToString("MM-dd-yy")}";
            htmlTextBoxProgram.Value     = $@"PROGRAM : {program.ProgramFullName}";
            htmlTextBoxPeriod.Value      = $@"PERIOD : {programRegistration.StartDate?.ToString("MM-dd-yy")} ~ {programRegistration.EndDate?.ToString("MM-dd-yy")}";

            switch (siteLocation.SiteId)
            {
            // CAC
            case 2:
                textBoxName.Value     = "Christine Jang";
                textBoxJobTitle.Value = "Site Administrator";
                break;

            default:
                textBoxName.Value     = string.Empty;
                textBoxJobTitle.Value = string.Empty;
                break;
            }

            try
            {
                var logoPath = new CGlobal().GetLogoImagePath((int)invoice.SiteLocationId, CConstValue.ImageType.Logo);
                if (logoPath != string.Empty)
                {
                    pictureBoxCompanyLogo.Value = Image.FromFile(logoPath);
                }
            }
            catch (Exception ex)
            {
                Debug.Print(ex.Message);
            }

            try
            {
                var sideLogoPath = new CGlobal().GetLogoImagePath((int)invoice.SiteLocationId, CConstValue.ImageType.LogoSide);
                if (sideLogoPath != string.Empty)
                {
                    pictureBoxSideLogo.Value = Image.FromFile(sideLogoPath);
                }
            }
            catch (Exception ex)
            {
                Debug.Print(ex.Message);
            }
        }
示例#26
0
        protected void RadToolBar1_ButtonClick(object sender, RadToolBarEventArgs e)
        {
            switch (e.Item.Text)
            {
            case "Save":
                if (IsValid)
                {
                    foreach (var chkItem in RadComboBoxMenu.CheckedItems)
                    {
                        var cInvoice = new CInvoice();
                        var invoice  = new Erp2016.Lib.Invoice();

                        invoice.StudentId = Convert.ToInt32(chkItem.Value);

                        invoice.Status         = (int)CConstValue.InvoiceStatus.Pending; // pending
                        invoice.SiteLocationId = CurrentSiteLocationId;
                        invoice.InvoiceType    = (int)CConstValue.InvoiceType.Simple;    //Simple Invoice(SI)

                        invoice.CreatedId   = CurrentUserId;
                        invoice.CreatedDate = DateTime.Now;

                        var invoiceId = cInvoice.Add(invoice);     //DB:Invoice

                        if (invoiceId > 0)
                        {
                            var cInvoiceItem = new CInvoiceItem();
                            var gridData     = InvoiceItemGrid1.GetGridData();
                            gridData = gridData.Insert(0, ",");
                            var gridDataRows = gridData.Split('|');
                            foreach (var gridDataRow in gridDataRows)
                            {
                                if (string.IsNullOrEmpty(gridDataRow))
                                {
                                    break;
                                }

                                var gridDataRowCell = gridDataRow.Split(',');

                                var invoiceCoaItem = gridDataRowCell[1];
                                var standardPrice  = gridDataRowCell[2];
                                var studentPrice   = gridDataRowCell[3];
                                var agencyPrice    = gridDataRowCell[4];
                                var remark         = gridDataRowCell[5];

                                var invoiceItem = new InvoiceItem();
                                invoiceItem.InvoiceId = invoiceId;
                                var cInvoiceCoaItem = new CInvoiceCoaItem();
                                invoiceItem.InvoiceCoaItemId = cInvoiceCoaItem.Get(invoiceCoaItem).InvoiceCoaItemId;
                                if (!string.IsNullOrEmpty(standardPrice))
                                {
                                    invoiceItem.StandardPrice = Convert.ToDecimal(standardPrice.Replace("$", string.Empty));
                                }
                                if (!string.IsNullOrEmpty(studentPrice))
                                {
                                    invoiceItem.StudentPrice = Convert.ToDecimal(studentPrice.Replace("$", string.Empty));
                                }
                                if (!string.IsNullOrEmpty(agencyPrice))
                                {
                                    invoiceItem.AgencyPrice = Convert.ToDecimal(agencyPrice.Replace("$", string.Empty));
                                }
                                invoiceItem.Remark = remark;

                                invoiceItem.CreatedId   = CurrentUserId;
                                invoiceItem.CreatedDate = DateTime.Now;

                                cInvoiceItem.Add(invoiceItem);
                            }
                        }
                    }
                    RunClientScript("Close();");
                }
                else
                {
                    ShowMessage("Error to add Simple Invoice");
                }
                break;

            case "Cancel":
                RunClientScript("Close();");
                break;
            }
        }
示例#27
0
        public RPayment(int reportType, int currentUserId, int invoiceId, string paymentArray = null)
        {
            //
            // Required for telerik Reporting designer support
            //
            InitializeComponent();

            ReportParameters["InvoiceId"].Value = invoiceId;

            var cUser = new CUser();
            var user  = cUser.Get(currentUserId);

            textBoxReceiptIssuer.Value = cUser.GetUserName(user);

            var sqlDataSourcePaymentHistoryParameter = sqlDataSourcePaymentHistory.Parameters[0];
            var detailsTableFilter = detailsTable.Filters[0];
            var tableTotalFilter   = tableTotal.Filters[0];

            switch (reportType)
            {
            case (int)CConstValue.Report.PaymentStudent:
                // default
                break;

            case (int)CConstValue.Report.PaymentAgency:
                // Payment
                textBoxInvoiceTitle.Value = "Receipt (Net)";
                textBoxTotalInvoice.Value = "= Fields.AgencyPriceSum";
                textBoxBalance.Value      = "= Fields.AgencyPriceSum - Fields.PayAmount";

                // Invoice
                itemDescriptionTextBoxStudentPrice.Value = "= Fields.AgencyPrice";
                textBoxStudentPriceSum2.Value            = "=Sum(Fields.AgencyPrice)";
                break;

            case (int)CConstValue.Report.DetailPaymentStudent:
                sqlDataSourcePaymentHistoryParameter.Name  = "PaymentId";
                sqlDataSourcePaymentHistoryParameter.Value = "In (" + paymentArray + ")";

                detailsTableFilter.Expression = "= Fields.PaymentId";
                detailsTableFilter.Operator   = FilterOperator.In;
                detailsTableFilter.Value      = "= Split(\",\", \"" + paymentArray + "\")";

                tableTotalFilter.Expression = "= Fields.PaymentId";
                tableTotalFilter.Operator   = FilterOperator.In;
                tableTotalFilter.Value      = "= Split(\",\", \"" + paymentArray + "\")";
                break;

            case (int)CConstValue.Report.DetailPaymentAgency:
                sqlDataSourcePaymentHistoryParameter.Name  = "PaymentId";
                sqlDataSourcePaymentHistoryParameter.Value = "In (" + paymentArray + ")";

                detailsTableFilter.Expression = "= Fields.PaymentId";
                detailsTableFilter.Operator   = FilterOperator.In;
                detailsTableFilter.Value      = "= Split(\",\", \"" + paymentArray + "\")";

                tableTotalFilter.Expression = "= Fields.PaymentId";
                tableTotalFilter.Operator   = FilterOperator.In;
                tableTotalFilter.Value      = "= Split(\",\", \"" + paymentArray + "\")";

                // additional
                textBoxInvoiceTitle.Value = "Receipt (Net)";
                textBoxTotalInvoice.Value = "= Fields.AgencyPriceSum";
                textBoxBalance.Value      = "= Fields.AgencyPriceSum - Fields.PayAmount";

                // Invoice
                itemDescriptionTextBoxStudentPrice.Value = "= Fields.AgencyPrice";
                textBoxStudentPriceSum2.Value            = "=Sum(Fields.AgencyPrice)";
                break;
            }

            var invoice = new CInvoice().Get(invoiceId);

            if (invoice != null)
            {
                var logoPath = new CGlobal().GetLogoImagePath((int)invoice.SiteLocationId, CConstValue.ImageType.Basic);
                if (logoPath != string.Empty)
                {
                    companyLogoPictureBox.Value = Image.FromFile(logoPath);
                }
            }
        }
示例#28
0
    public static void SetFilterCheckListItems(GridFilterCheckListItemsRequestedEventArgs e)
    {
        object dataSource = null;
        string dataField  = (e.Column as IGridDataColumn).GetActiveDataField();

        switch (dataField)
        {
        // Common
        case "SiteName":
            dataSource = new CSite().GetSiteNameList();
            break;

        case "SiteLocationName":
            dataSource = new CSiteLocation().GetSiteLocationNameList();
            break;

        case "CountryName":
            dataSource = new CCountry().GetCountryNameList();
            break;

        case "AgencyName":
            dataSource = new CAgency().GetAgencyNameList();
            break;

        case "ProgramName":
            dataSource = new CProgram().GetProgramNameList();
            break;

        case "InvoiceCoaItemId":
            dataSource = new CInvoiceCoaItem().GetInvoiceCoaItemIdNameList();
            break;

        case "InvoiceName":
            dataSource = new CProgram().GetInvoiceNameList();
            break;

        case "StudentName":
            dataSource = new CStudent().GetStudentNameList();
            break;

        case "UserName":
            dataSource = new CUser().GetUserNameList();
            break;

        case "Status":
            dataSource = new CApproval().GetStatusNameList();
            break;

        case "ApprovalUserName":
            dataSource = new CUser().GetApprovalUserNameList();
            break;

        case "InstructorName":
            dataSource = new CUser().GetInstructorNameList();
            break;

        case "ProgramStatusName":
            dataSource = new CProgramRegistration().GetProgramStatusList();
            break;

        // Dashboard
        case "Type":
            dataSource = new CApproval().GetApprovalTypeNameList();
            break;

        // Invoice
        case "InvoiceType":
            dataSource = new CInvoice().GetInvoiceTypeList();
            break;

        case "InvoiceStatus":
            dataSource = new CInvoice().GetInvoiceStatusList();
            break;

        // Deposit
        case "DepositStatus":
            dataSource = new CDeposit().GetDepositStatusNameList();
            break;

        case "DepositBank":
            dataSource = new CDeposit().GetDepositBankNameList();
            break;

        case "PaidMethod":
            dataSource = new CDeposit().GetPaidMethodNameList();
            break;

        case "ExtraTypeName":
            dataSource = new CDeposit().GetExtraTypeNameList();
            break;

        // CreditMemo
        case "CreditMemoType":
            dataSource = new CCreditMemo().GetCreditMemoTypeNameList();
            break;

        case "PayoutMethodName":
            dataSource = new CCreditMemoPayout().GetPayoutMethodNameList();
            break;

        // Academic
        case "FacultyName":
            dataSource = new CFaculty().GetFacultyNameList();
            break;

        case "ProgramGroupName":
            dataSource = new CProgramGroup().GetProgramGroupNameList();
            break;

        // Vacation
        case "VacationType":
            dataSource = new CVacation().GetVacationTypeNameList();
            break;

        // User
        case "CreatedUserName":
            dataSource = new CUser().GetCreatedUserNameList();
            break;

        case "UpdatedUserName":
            dataSource = new CUser().GetUpdatedUserNameList();
            break;

        case "PositionName":
            dataSource = new CUser().GetPositionNameList();
            break;

        case "Email":
            dataSource = new CUser().GetEmailNameList();
            break;

        case "LoginId":
            dataSource = new CUser().GetLoginIdNameList();
            break;

        // PurchaseOrder
        case "PurchaseOrderTypeName":
            dataSource = new CPurchaseOrder().GetPurchaseOrderTypeNameList();
            break;

        case "PriorityTypeName":
            dataSource = new CPurchaseOrder().GetPriorityTypeNameList();
            break;

        case "ReviewTypeName":
            dataSource = new CPurchaseOrder().GetReviewTypeNameList();
            break;
        ////Invoice#
        //case "SchoolName":
        //    dataSource = new CSite().GetSiteNameList();
        //    break;

        // Inventory
        case "AssignedUserName":
            dataSource = new CUser().GetAssignedUserNameList();
            break;

        case "InventoryCategoryName":
            dataSource = new CInventory().GetInventoryCategoryNameList();
            break;

        case "InventoryCategoryItemName":
            dataSource = new CInventory().GetInventoryCategoryItemNameList();
            break;

        case "ConditionName":
            dataSource = new CInventory().GetConditionNameList();
            break;

        case "InUseName":
            dataSource = new CInventory().GetInUseNameList();
            break;
        }

        if (dataSource != null)
        {
            SetFilter(e, dataField, dataSource);
        }
    }
示例#29
0
        protected void MainToolBar_ButtonClick(object sender, RadToolBarEventArgs e)
        {
            if (e.Item.Text == @"Reject" && !string.IsNullOrEmpty(hfId.Value))
            {
                if (IsValid)
                {
                    try
                    {
                        var type     = Convert.ToInt32(hfType.Value);
                        var id       = Convert.ToInt32(hfId.Value);
                        var idNumber = string.Empty;

                        var cApprovalHistory = new CApprovalHistory();
                        var approvalHistory  = cApprovalHistory.Get(type, id, CurrentUserId);
                        approvalHistory.ApprovalDate = DateTime.Now;
                        approvalHistory.ApprovalMemo = tbRemark.Text;
                        // Reject
                        approvalHistory.ApprovalStep = (int)CConstValue.ApprovalStatus.Rejected;

                        if (type == (int)CConstValue.Approval.Refund)
                        {
                            var cC = new CRefund();
                            var c  = cC.Get(id);
                            c.ApprovalDate   = approvalHistory.ApprovalDate;
                            c.ApprovalId     = approvalHistory.ApprovalUser;
                            c.ApprovalMemo   = approvalHistory.ApprovalMemo;
                            c.ApprovalStatus = approvalHistory.ApprovalStep;

                            if (cC.Update(c))
                            {
                                var cInvoiceInfo = new CInvoice();
                                var invoiceInfo  = cInvoiceInfo.Get(c.InvoiceId);

                                var cOriginalInvoiceInfo = new CInvoice();
                                var originalInvoiceInfo  = cOriginalInvoiceInfo.Get(Convert.ToInt32(invoiceInfo.OriginalInvoiceId));

                                invoiceInfo.Status    = (int)CConstValue.InvoiceStatus.Cancelled_RF; // Canceled_R
                                invoiceInfo.UpdatedId = CurrentUserId;

                                originalInvoiceInfo.Status    = (int)CConstValue.InvoiceStatus.Invoiced; // Invoiced
                                originalInvoiceInfo.UpdatedId = CurrentUserId;

                                cInvoiceInfo.Update(invoiceInfo);
                                cOriginalInvoiceInfo.Update(originalInvoiceInfo);
                            }
                        }
                        // Agency
                        else if (type == (int)CConstValue.Approval.Agency)
                        {
                            var cC = new CAgency();
                            var c  = cC.Get(id);
                            idNumber         = c.AgencyNumber;
                            c.ApprovalDate   = approvalHistory.ApprovalDate;
                            c.ApprovalId     = approvalHistory.ApprovalUser;
                            c.ApprovalMemo   = approvalHistory.ApprovalMemo;
                            c.ApprovalStatus = approvalHistory.ApprovalStep;

                            cC.Update(c);
                        }
                        else if (type == (int)CConstValue.Approval.CorporateCreditCard)
                        {
                            var cC = new CCorporateCreditCard();
                            var c  = cC.Get(id);
                            c.ApprovalDate   = approvalHistory.ApprovalDate;
                            c.ApprovalId     = approvalHistory.ApprovalUser;
                            c.ApprovalMemo   = approvalHistory.ApprovalMemo;
                            c.ApprovalStatus = approvalHistory.ApprovalStep;

                            cC.Update(c);
                        }
                        // BusinessTrip
                        else if (type == (int)CConstValue.Approval.BusinessTrip)
                        {
                            var cC = new CBusinessTrip();
                            var c  = cC.Get(id);
                            c.ApprovalDate   = approvalHistory.ApprovalDate;
                            c.ApprovalId     = approvalHistory.ApprovalUser;
                            c.ApprovalMemo   = approvalHistory.ApprovalMemo;
                            c.ApprovalStatus = approvalHistory.ApprovalStep;

                            cC.Update(c);
                        }
                        // PackageProgram
                        else if (type == (int)CConstValue.Approval.Package)
                        {
                            var cC = new CPackageProgram();
                            var c  = cC.GetPackageProgram(id);
                            c.ApprovalDate   = approvalHistory.ApprovalDate;
                            c.ApprovalId     = approvalHistory.ApprovalUser;
                            c.ApprovalMemo   = approvalHistory.ApprovalMemo;
                            c.ApprovalStatus = approvalHistory.ApprovalStep;

                            cC.Update(c);
                        }
                        // Expense
                        else if (type == (int)CConstValue.Approval.Expense)
                        {
                            var cC = new CExpense();
                            var c  = cC.Get(id);
                            c.ApprovalDate   = approvalHistory.ApprovalDate;
                            c.ApprovalId     = approvalHistory.ApprovalUser;
                            c.ApprovalMemo   = approvalHistory.ApprovalMemo;
                            c.ApprovalStatus = approvalHistory.ApprovalStep;

                            cC.Update(c);
                        }
                        // Purchase Order
                        else if (type == (int)CConstValue.Approval.PurchaseOrder)
                        {
                            var cP = new CPurchaseOrder();
                            var c  = cP.Get(id);
                            c.ApprovalDate   = approvalHistory.ApprovalDate;
                            c.ApprovalId     = approvalHistory.ApprovalUser;
                            c.ApprovalMemo   = approvalHistory.ApprovalMemo;
                            c.ApprovalStatus = approvalHistory.ApprovalStep;

                            cP.Update(c);
                        }
                        // Hire
                        else if (type == (int)CConstValue.Approval.Hire)
                        {
                            var cC = new CHire();
                            var c  = cC.Get(id);
                            c.ApprovalDate   = approvalHistory.ApprovalDate;
                            c.ApprovalId     = approvalHistory.ApprovalUser;
                            c.ApprovalMemo   = approvalHistory.ApprovalMemo;
                            c.ApprovalStatus = approvalHistory.ApprovalStep;

                            cC.Update(c);
                        }
                        // Vacation
                        else if (type == (int)CConstValue.Approval.Vacation)
                        {
                            var cC = new CVacation();
                            var c  = cC.Get(id);
                            c.ApprovalDate   = approvalHistory.ApprovalDate;
                            c.ApprovalId     = approvalHistory.ApprovalUser;
                            c.ApprovalMemo   = approvalHistory.ApprovalMemo;
                            c.ApprovalStatus = approvalHistory.ApprovalStep;

                            cC.Update(c);
                        }
                        //Scholarship
                        else if (type == (int)CConstValue.Approval.Scholarship)
                        {
                            var cC = new CScholarship();
                            var c  = cC.Get(id);
                            idNumber         = c.ScholarshipMasterNo;
                            c.ApprovalDate   = approvalHistory.ApprovalDate;
                            c.ApprovalId     = approvalHistory.ApprovalUser;
                            c.ApprovalMemo   = approvalHistory.ApprovalMemo;
                            c.ApprovalStatus = approvalHistory.ApprovalStep;
                            cC.Update(c);
                        }
                        //Promotion
                        else if (type == (int)CConstValue.Approval.Promotion)
                        {
                            var cC = new CPromotion();
                            var c  = cC.Get(id);
                            idNumber         = c.PromotionMasterNo;
                            c.ApprovalDate   = approvalHistory.ApprovalDate;
                            c.ApprovalId     = approvalHistory.ApprovalUser;
                            c.ApprovalMemo   = approvalHistory.ApprovalMemo;
                            c.ApprovalStatus = approvalHistory.ApprovalStep;
                            cC.Update(c);
                        }
                        // CreditMemo
                        else if (type == (int)CConstValue.Approval.CreditMemoPayout)
                        {
                            var cC = new CCreditMemoPayout();
                            var c  = cC.Get(id);
                            c.ApprovalDate   = approvalHistory.ApprovalDate;
                            c.ApprovalId     = approvalHistory.ApprovalUser;
                            c.ApprovalMemo   = approvalHistory.ApprovalMemo;
                            c.ApprovalStatus = approvalHistory.ApprovalStep;
                            cC.Update(c);
                        }

                        // update approvalHistory
                        cApprovalHistory.Update(approvalHistory);

                        new CMail().SendMail((CConstValue.Approval)type, CConstValue.MailStatus.ToRequestUser, id, idNumber, CurrentUserId);

                        RunClientScript("Close();");
                    }
                    catch (Exception ex)
                    {
                        ShowMessage(ex.Message);
                    }
                }
            }
        }
示例#30
0
        public RLetterOfAcceptanceInTable(int invoiceId)
        {
            //
            // Required for telerik Reporting designer support
            //
            InitializeComponent();

            var invoice = new CInvoice().Get(invoiceId);

            if (invoice?.ProgramRegistrationId == null)
            {
                return;
            }

            var programRegistration = new CProgramRegistration().Get((int)invoice.ProgramRegistrationId);

            if (programRegistration == null)
            {
                return;
            }

            var cStudent = new CStudent();
            var student  = cStudent.Get((int)invoice.StudentId);

            if (student == null)
            {
                return;
            }

            var program      = new CProgram().Get(programRegistration.ProgramId);
            var siteLocation = new CSiteLocation().Get(student.SiteLocationId);
            var site         = new CSite().Get(siteLocation.SiteId);

            textBoxDLI.Value         = $@"Designated learning institution number (DLI #) : {"O19375754382"}";
            textBoxDateOfIssue.Value = $@"Date of Issue : {DateTime.Today.ToString("MM-dd-yy")}";

            htmlTextBoxFaimlyName.Value           = $@"1. Family Name : <br><b>{student.LastName1}</b>";
            htmlTextBoxFirstName.Value            = $@"2. First Name and Initials : <br><b>{student.FirstName}</b>";
            htmlTextBoxDateOfBirth.Value          = $@"3. Date of Birth : <br><b>{student.DOB?.ToString("MM-dd-yy")}</b>";
            htmlTextBoxStudentId.Value            = $@"4. Student ID Number : <br><b>{student.StudentNo}</b>";
            htmlTextBoxStudentFull.Value          = $@"5. Student Full Mailing Address : <br><b>{student.Address1InCanada}</b>";
            htmlTextBoxDates.Value                = $@"6. Dates : <br>Start Date : <b>{programRegistration.StartDate?.ToString("MM-dd-yy")}</b><br>Completion Date : <b>{programRegistration.EndDate?.ToString("MM-dd-yy")}</b>";
            htmlTextBoxNameOfSchool.Value         = $@"7. Name of School/Institution(include public or private) : <br><b>{site.Name}</b>";
            htmlTextBoxLevelOfStudy.Value         = $@"8. Level of Study : <br><b>{"N/A"}</b>";
            htmlTextBoxProgram.Value              = $@"9. Program/Major/Course : <br><b>{program.ProgramFullName + " " + (programRegistration.HrsStatus == null ? string.Empty : "(" + programRegistration.HrsStatus + "/week)")}</b>";
            htmlTextBoxHoursOfInstruction.Value   = $@"10. Hours of Instruction per Week : <br><b>{programRegistration.Weeks}</b>";
            htmlTextBoxAcademicYear.Value         = $@"11. Academic Year of Study which the student will enter (e.g., Year 2 of 3 Year Program)<br><b>{"N/A"}</b>";
            htmlTextBoxLateRegistrationDate.Value = $@"12. Late Registration Date : <br><b>{"N/A"}</b>";

            var vwStudentContract = new CStudent().GetVwStudentContract(invoiceId);
            var isFullPayment     = false;

            if (vwStudentContract?.DepositConfirmCnt == vwStudentContract?.PaymentCnt && vwStudentContract.Balance == 0)
            {
                isFullPayment = true;
            }

            htmlTextBoxConditionOfAcceptance.Value = $@"13. Condition of Acceptance : (must be paid in full at least 2 weeks before start date)<br><b>{(isFullPayment ? "Full Fee Payment" : "Not fully Fee Payment")}</b>";

            var invoiceItemList = new CInvoiceItem().GetInvoiceItems(invoiceId);
            var tuitionFee      = invoiceItemList.FirstOrDefault(x => x.InvoiceCoaItemId == (int)CConstValue.InvoiceCoaItem.TuitionBasic);

            htmlTextBoxEstimatedTuitionFees.Value = $@"14. Estimated Tuition Fees : (not including homestay accommodation fee)<br>Tuition Fee : <b>${tuitionFee}</b>";

            string scholarshipMasterNo = string.Empty;

            if (invoice.ScholarshipId != null)
            {
                scholarshipMasterNo = new CScholarship().Get((int)invoice.ScholarshipId)?.ScholarshipMasterNo;
            }

            htmlTextBoxScholarship.Value               = $@"15. Scholarship/Teaching Assistantship: <br><b>{scholarshipMasterNo}</b>";
            htmlTextBoxExchangeStudent.Value           = $@"16. Exchange Student (yes/no) : <br><b>{"No"}</b>";
            htmlTextBoxLicensingInformation.Value      = $@"17. Licensing Information where applicable for Private Institution (yes/no/not applicable): <br><b>{"N/A"}</b>";
            htmlTextBoxIfDestinedForQuebec.Value       = $@"18. If destined for Quebec, has CAQ information been sent to student (yes/no/not applicable) : <br><b>{"N/A"}</b>";
            htmlTextBoxGuardianship.Value              = $@"19. Guardianship/Custodianship details if applicable : <br><b>{"N/A"}</b>";
            htmlTextBoxCredentials.Value               = $@"20. Credentials : <br><b>{site.Name} Certificates and/or Diploma</b>";
            htmlTextBoxRequirementsForSuccessful.Value = $@"21. Requirements for successful program completion : <br><b>{"70% grade and 85% attendance"}</b>";
            htmlTextBoxSignatureOfInstitution.Value    = $@"22. Signature of Institution Representative : <br>";

            string name     = string.Empty;
            string position = string.Empty;

            switch (siteLocation.SiteId)
            {
            // CAC
            case 2:
                name     = "Christine Jang";
                position = "Site Administrator";
                break;

            default:
                name     = string.Empty;
                position = string.Empty;
                break;
            }

            htmlTextBoxNameOfInstitution.Value = $@"23. Name of Institution Representative (please print) : <br><b>{name} - {position}</b>";

            htmlTextBoxStudentSignature.Value = $@"24. Student's signature : <br><br><br><br><br>I have read and received a copy this contract and a copy of statement of the student's rights and responsibilities.";

            try
            {
                var logoPath = new CGlobal().GetLogoImagePath((int)invoice.SiteLocationId, CConstValue.ImageType.Logo);
                if (logoPath != string.Empty)
                {
                    pictureBoxCompanyLogo.Value = Image.FromFile(logoPath);
                }
            }
            catch (Exception ex)
            {
                Debug.Print(ex.Message);
            }

            try
            {
                var signPath = new CGlobal().GetLogoImagePath((int)invoice.SiteLocationId, CConstValue.ImageType.Sign);
                if (signPath != string.Empty)
                {
                    pictureBoxSign.Value = Image.FromFile(signPath);
                }
            }
            catch (Exception ex)
            {
                Debug.Print(ex.Message);
            }

            try
            {
                var sideLogoPath = new CGlobal().GetLogoImagePath((int)invoice.SiteLocationId, CConstValue.ImageType.LogoSide);
                if (sideLogoPath != string.Empty)
                {
                    pictureBoxSideLogo.Value = Image.FromFile(sideLogoPath);
                }
            }
            catch (Exception ex)
            {
                Debug.Print(ex.Message);
            }
        }