protected void Page_Load(object sender, EventArgs e) { // CreditMemoId in new or CreditMemoPayoutId in modify Id = Convert.ToInt32(Request["id"]); if (!IsPostBack) { FileDownloadList1.InitFileDownloadList((int)CConstValue.Upload.CreditMemo); CreditMemoPayout1.SetCreditVisible(false); CreditMemoPayout1.SetReadonly(false); // new if (Request["type"] == "0") { // } // modify else { var cCreditMemoPayout = new CCreditMemoPayout().Get(Id); RadNumericTextBoxAmount.Value = (double)cCreditMemoPayout.Amount; RadNumericTextBoxAmount.ReadOnly = true; CreditMemoPayout1.SetData(cCreditMemoPayout); // get Filedownload List FileDownloadList1.GetFileDownload(Id); } } }
protected void CreditMemoPayout1_OnPreRender(object sender, EventArgs e) { if (RadGridRefund.SelectedValue != null) { var cCreditMemoPayout = new CCreditMemoPayout(); var creditMemoPayout = cCreditMemoPayout.Get(Convert.ToInt32(RadGridRefund.SelectedValues["CreditMemoPayoutId"])); if (creditMemoPayout != null) { CreditMemoPayout1.SetData(creditMemoPayout); } } }
protected void Page_Load(object sender, EventArgs e) { //if (Request["__EVENTTARGET"] == "btnNew" && //Request["__EVENTARGUMENT"] == "MyArgument") //{ // //do something //} // Refund_R InvoiceItemGrid1.SetTypeOfInvoiceCoaItem(2); RefundId = Convert.ToInt32(Request["id"]); // find user control _sqlDataSourceInvoiceItems = InvoiceItemGrid1.GetSqlDataSourceInvoiceItems(); _radGridInvoiceItems = InvoiceItemGrid1.GetRadGridInvoiceItems(); // connect event of invoice Items. _radGridInvoiceItems.PreRender += _radGridInvoiceItems_PreRender; //_radGridInvoiceItems.MasterTableView.CommandItemSettings.ShowSaveChangesButton = false; FileDownloadList1.InitFileDownloadList((int)CConstValue.Upload.Refund); CreditMemoPayout1.SetReadonly(false); if (!IsPostBack) { //// new //if (Request["type"] == "0") //{ // // nothing //} //else //{ var cRefund = new CRefund(); var refund = cRefund.Get(RefundId); FileDownloadList1.GetFileDownload(refund.RefundId); InvoiceItemGrid1.InvoiceId = refund.InvoiceId; InvoiceItemGrid1.SetEditMode(true); CreditMemoPayout1.SetCreditVisible(true); var cCreditMemoPayout = new CCreditMemoPayout(); var creditMemoPayout = cCreditMemoPayout.Get(refund.CreditMemoPayoutId); CreditMemoPayout1.SetData(creditMemoPayout); //} } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { // todo: here var excel = RadToolBarCreditMemo.FindItemByText("Excel"); if (CurrentGroupId == (int)CConstValue.UserGroupForAccountExcelExport.Accounting || CurrentGroupId == (int)CConstValue.UserGroupForAccountExcelExport.IT) { excel.Visible = true; } FileDownloadList1.InitFileDownloadList((int)CConstValue.Upload.CreditMemo); FileDownloadList1.SetVisibieUploadControls(false); CreditMemoPayout1.SetCreditVisible(false); } SearchCreditmemo(); SearchCreditmemoPayout(); SearchCreditmemoPayoutHistory(); }
protected void RadToolBar_ButtonClick(object sender, RadToolBarEventArgs e) { switch (e.Item.Text) { case "TempSave": case "Request": if (IsValid) { var cC = new CCreditMemoPayout(); var c = new Erp2016.Lib.CreditMemoPayout(); // new if (Request["type"] == "0") { c = new Erp2016.Lib.CreditMemoPayout(); c.CreatedId = CurrentUserId; c.CreatedDate = DateTime.Now; c.CreditMemoId = Id; } // modify else { c = cC.Get(Id); } c = CreditMemoPayout1.GetData(c); c.Amount = (decimal)RadNumericTextBoxAmount.Value; c.IsActive = true; c.SiteLocationId = CurrentSiteLocationId; int creditMemoPayoutId; // new if (Request["type"] == "0") { decimal availableAmount = new CCreditMemo().GetAvailableCreditAmount(Id); if (availableAmount >= c.Amount) { decimal originalAmount = new CCreditMemo().GetOriginalCreditAmount(Id); if ((originalAmount - availableAmount) + c.Amount < 0) { ShowMessage("result of available amount can't be negative amount"); } else { creditMemoPayoutId = cC.Add(c); // save file FileDownloadList1.SaveFile(Id); if (e.Item.Text == "TempSave") { RunClientScript("Close();"); } else { if (SetReqeust(creditMemoPayoutId)) { RunClientScript("Close();"); } else { ShowMessage("error requesting"); } } } } else { ShowMessage("paid amount is bigger than available credit amount"); } } // modify else { c.UpdatedId = CurrentUserId; c.UpdatedDate = DateTime.Now; cC.Update(c); creditMemoPayoutId = c.CreditMemoPayoutId; // save file FileDownloadList1.SaveFile(Id); if (SetReqeust(creditMemoPayoutId)) { RunClientScript("Close();"); } else { ShowMessage("error requesting"); } } } break; case "Close": RunClientScript("Close();"); break; } }
protected void RadToolBar_ButtonClick(object sender, RadToolBarEventArgs e) { switch (e.Item.Text) { case "TempSave": case "Request": if (IsValid) { var cRefund1 = new CRefund(); var refund1 = cRefund1.Get(RefundId); FileDownloadList1.SaveFile(refund1.RefundId); var cCreditMemoPayout = new CCreditMemoPayout(); var creditMemoPayout = cCreditMemoPayout.Get(refund1.CreditMemoPayoutId); creditMemoPayout = CreditMemoPayout1.GetData(creditMemoPayout); creditMemoPayout.UpdatedId = CurrentUserId; if (cCreditMemoPayout.Update(creditMemoPayout)) { if (cRefund1.Update(refund1)) { if (e.Item.Text == "TempSave") { RunClientScript("Close();"); } else { var cApprovalHistory = new CApprovalHistory(); cApprovalHistory.DelApprovalHistory((int)CConstValue.Approval.Refund, RefundId); // approve request var approval = new CApproval().ApproveRequstCreate((int)CConstValue.Approval.Refund, CurrentUserId, RefundId); if (approval > 0) { var cRefund = new CRefund(); var refund = cRefund.Get(RefundId); refund.ApprovalStatus = approval; refund.ApprovalId = CurrentUserId; refund.ApprovalDate = DateTime.Now; //packageProgram.ApprovalMemo = ""; cRefund.Update(refund); new CMail().SendMail(CConstValue.Approval.Refund, CConstValue.MailStatus.ToApproveUser, refund.RefundId, string.Empty, CurrentUserId); RunClientScript("Close();"); } else { ShowMessage("error requesting"); } } } else { ShowMessage("Error updating refund"); } } else { ShowMessage("Error updating creditMemoPayout"); } } else { ShowMessage("Error can't find refund"); } break; case "Close": RunClientScript("Close();"); break; } }
public void GetCreditMemoPayoutInfo() { // toolbar foreach (RadToolBarItem toolbarItem in RadToolBarCreditMemo.Items) { if (toolbarItem.Text == "Disbursement") { if (RadGridCreditMemo.SelectedValue != null) { var creditMemo = new CCreditMemo().GetVwCreditMemo(Convert.ToInt32(RadGridCreditMemo.SelectedValue)); if (creditMemo != null) { var cCreditMemoPayout = new CCreditMemoPayout(); var creditMemoPayoutList = cCreditMemoPayout.GetCreditMemoPayoutList(creditMemo.CreditMemoId); bool hasNullOfDisbursement = false; foreach (var c in creditMemoPayoutList) { if (c.Disbursement == false && c.ApprovalStatus == (int)CConstValue.ApprovalStatus.Approved) { toolbarItem.Enabled = true; hasNullOfDisbursement = true; break; } } if (hasNullOfDisbursement == false) { toolbarItem.Enabled = false; } } else { toolbarItem.Enabled = false; } } else { toolbarItem.Enabled = false; } } else { if (toolbarItem.Text == "View Invoice" || toolbarItem.Text == "View Payment" || toolbarItem.Text == "View Deposit" || toolbarItem.Text == "Student Page" || toolbarItem.Text == "Invoice Page" || toolbarItem.Text == "Payment Page" || toolbarItem.Text == "Deposit Page" || toolbarItem.Text == "Refund Page" || toolbarItem.Text == "Excel") { continue; } toolbarItem.Enabled = false; } } // toolbar foreach (RadToolBarItem toolbarItem in RadToolBarCreditMemoPayout.Items) { if (toolbarItem.Text == "New Payout") { if (RadGridCreditMemo.SelectedValue != null) { toolbarItem.Enabled = true; } else { toolbarItem.Enabled = false; } } } if (RadGridCreditMemoPayout.SelectedValue != null) { var cCreditMemoPayout = new CCreditMemoPayout(); var creditMemoPayout = cCreditMemoPayout.Get(Convert.ToInt32(RadGridCreditMemoPayout.SelectedValue)); CreditMemoPayout1.SetData(creditMemoPayout); // toolbar foreach (RadToolBarItem toolbarItem in RadToolBarCreditMemoPayout.Items) { // request active check if (toolbarItem.Text == "Request") { if ((creditMemoPayout.ApprovalStatus == null || creditMemoPayout.ApprovalStatus == (int)CConstValue.ApprovalStatus.Revise) && creditMemoPayout.CreatedId == CurrentUserId) { toolbarItem.Enabled = true; } else { toolbarItem.Enabled = false; } } else if (toolbarItem.Text == "Cancel") { if ((creditMemoPayout.ApprovalStatus == null || creditMemoPayout.ApprovalStatus == (int)CConstValue.ApprovalStatus.Revise || creditMemoPayout.ApprovalStatus == (int)CConstValue.ApprovalStatus.Requested) && creditMemoPayout.CreatedId == CurrentUserId) { toolbarItem.Enabled = true; } else { toolbarItem.Enabled = false; } } else if (toolbarItem.Text == "Approve" || toolbarItem.Text == "Reject" || toolbarItem.Text == "Revise") { // approve active check var refundApproveInfo = new CGlobal(); var supervisor = refundApproveInfo.CheckApprovalEnable((int)CConstValue.Approval.CreditMemoPayout, Convert.ToInt32(RadGridCreditMemoPayout.SelectedValue)); // supervisor or loy employees if ((CurrentUserId == supervisor) && creditMemoPayout.ApprovalStatus != (int)CConstValue.ApprovalStatus.Approved && creditMemoPayout.ApprovalStatus != (int)CConstValue.ApprovalStatus.Rejected && creditMemoPayout.ApprovalStatus != (int)CConstValue.ApprovalStatus.Canceled && creditMemoPayout.ApprovalStatus != null && CurrentUserId != creditMemoPayout.ApprovalId) { toolbarItem.Enabled = true; } else { toolbarItem.Enabled = false; } } } foreach (RadToolBarItem toolbarItem in RadToolBarCreditMemoPayoutHistory.Items) { if (toolbarItem.Text == "Add Payout") { if (creditMemoPayout.ApprovalStatus == (int)CConstValue.ApprovalStatus.Approved && creditMemoPayout.Disbursement && (CurrentGroupId == (int)CConstValue.UserGroupForCreditPayoutHistory.Accounting || CurrentGroupId == (int)CConstValue.UserGroupForCreditPayoutHistory.IT)) { toolbarItem.Enabled = true; } else { toolbarItem.Enabled = false; } } else if (toolbarItem.Text == "Payout Reverse") { if (CurrentGroupId == (int)CConstValue.UserGroupForCreditPayoutHistory.Accounting || CurrentGroupId == (int)CConstValue.UserGroupForCreditPayoutHistory.IT) { toolbarItem.Enabled = true; } else { toolbarItem.Enabled = false; } } } // get DownloadList FileDownloadList1.GetFileDownload(Convert.ToInt32(RadGridCreditMemoPayout.SelectedValue)); } else { foreach (RadToolBarItem toolbarItem in RadToolBarCreditMemoPayoutHistory.Items) { toolbarItem.Enabled = false; } // get DownloadList FileDownloadList1.GetFileDownload(0); } RefreshApprovalList(); }