protected void btnApprove_Click(object sender, EventArgs e) { SaveItems(); BindSuppliers(); DataTable dtQtnAmt = new DataTable(); dtQtnAmt.Columns.Add("qtnid"); dtQtnAmt.Columns.Add("amount"); DataRow dr; foreach (GridViewRow gr in rgdSupplierInfo.Rows) { string hdfGrandTotal = ((HiddenField)gr.FindControl("hdfQuotation_Status")).Value; if (hdfGrandTotal != "AP" && UDFLib.ConvertToDecimal(((HiddenField)gr.FindControl("hdfGrandTotal")).Value) > 0) { dr = dtQtnAmt.NewRow(); dr["qtnid"] = rgdSupplierInfo.DataKeys[gr.RowIndex].Values["Quotation_ID"].ToString(); dr["amount"] = ((HiddenField)gr.FindControl("hdfGrandTotal")).Value; dtQtnAmt.Rows.Add(dr); } } int sts = BLL_PURC_CTP.Upd_Ctp_Approve_Contract(Convert.ToInt32(Session["userid"]), dtQtnAmt, DateTime.Parse(txtEffectiveDate.Text), DateTime.Parse(txtExpiryDate.Text), txtRemark.Text); String msg1 = String.Format("alert('Approved successfuly');window.close();"); ScriptManager.RegisterStartupScript(Page, Page.GetType(), "msg123", msg1, true); }
protected void btnSaveItemDetails_Click(object s, EventArgs e) { btnSaveItemDetails.Enabled = false; DataTable dtGridItems = new DataTable(); dtGridItems.Columns.Add("PID"); dtGridItems.Columns.Add("ID"); dtGridItems.Columns.Add("item_name"); dtGridItems.Columns.Add("amount"); dtGridItems.Columns.Add("remark"); DataRow dr = null; int RowID = 1; foreach (GridViewRow grItem in gvItemList.Rows) { dr = dtGridItems.NewRow(); dr["PID"] = RowID++; dr["ID"] = ((HiddenField)grItem.FindControl("hdfID")).Value; dr["item_name"] = ((TextBox)grItem.FindControl("txtItem")).Text; dr["amount"] = UDFLib.ConvertToDecimal(((TextBox)grItem.FindControl("txtAmount")).Text); dr["remark"] = ((TextBox)grItem.FindControl("txtRemark")).Text; dtGridItems.Rows.Add(dr); } obQuoteRequest.Upd_Quotation_Additional_Charge(UDFLib.ConvertToInteger(Request.QueryString["QuotationRequest_ID"]), dtGridItems, Convert.ToInt32(Session["USERID"].ToString())); string CalculateTotal = String.Format("parent.ReloadParent_ByButtonID();"); ScriptManager.RegisterStartupScript(Page, Page.GetType(), "CalculateTotal", CalculateTotal, true); }
protected void rpt2_ItemDataBound(object sender, System.Web.UI.WebControls.RepeaterItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { Label lblAmt = (Label)e.Item.FindControl("lblAmt"); Label lblEarningDeduction = (Label)e.Item.FindControl("lblEarningDeduction"); if (lblAmt != null && lblEarningDeduction.Text == "Earning") { decimal Amt = UDFLib.ConvertToDecimal(lblAmt.Text); TotalAmount += Amt; } if (lblAmt != null && lblEarningDeduction.Text == "Deduction") { decimal Amt1 = UDFLib.ConvertToDecimal(lblAmt.Text); TotalAmountDeducted += Amt1; } } if (e.Item.ItemType == ListItemType.Footer) { Label lblTotalAmt = (Label)e.Item.FindControl("lblTotalAmt"); if (lblTotalAmt != null) { TotalAmount = TotalAmount - TotalAmountDeducted; lblTotalAmt.Text = TotalAmount.ToString("0.00"); TotalAmount = 0; TotalAmountDeducted = 0; } } }
protected void ddlDivisions_SelectedIndexChanged(object sender, EventArgs e) { decimal min = UDFLib.ConvertToDecimal(ddlMin.SelectedValue); decimal max = UDFLib.ConvertToDecimal(ddlMax.SelectedValue); int Division = UDFLib.ConvertToInteger(ddlDivisions.SelectedValue) - 1; //rdoOptions.Items.Clear(); DataTable dt = new DataTable("Options"); dt.Columns.Add("OptionText", typeof(string)); dt.Columns.Add("OptionValue", typeof(string)); if (min >= 0 && max > 0 && Division > 0) { decimal increment = (max - min) / Division; while (min <= max) { //rdoOptions.Items.Add(new ListItem(min.ToString(), min.ToString())); DataRow dr1 = dt.NewRow(); dr1[0] = min.ToString(); dr1[1] = min.ToString(); dt.Rows.Add(dr1); min += increment; } rptOptions.DataSource = dt; rptOptions.DataBind(); } }
private bool Validate_Ordered_Quantity() { bool isvalid = true; foreach (GridViewRow gr in gvItemsSplit.Rows) { int i = 0; decimal total_ord_qty = 0; decimal ord_qty = UDFLib.ConvertToDecimal((gr.Cells[remainingQtyColumnID].FindControl("qty" + remainingQtyColumnID.ToString()) as Label).Text); foreach (TableCell cell in gr.Cells) { if (i > lastFixedColumnID) { total_ord_qty += UDFLib.ConvertToDecimal(((TextBox)cell.FindControl(i.ToString())).Text); } i++; } if (total_ord_qty > ord_qty) { isvalid = false; gr.BackColor = System.Drawing.Color.Yellow; gr.ForeColor = System.Drawing.Color.Black; } } return(isvalid); }
protected void rptClaims_ItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType.ToString() == "Item" || e.Item.ItemType.ToString() == "AlternatingItem") { TotalRequestedUSD += UDFLib.ConvertToDecimal(DataBinder.Eval(e.Item.DataItem, "Requested_US_Amount").ToString()); TotalApprovedUSD += UDFLib.ConvertToDecimal(DataBinder.Eval(e.Item.DataItem, "Approved_US_Amount").ToString()); PendingCount += UDFLib.ConvertToInteger(DataBinder.Eval(e.Item.DataItem, "Claim_Status").ToString()) == 0 ? 1 : 0;; } if (e.Item.ItemType.ToString() == "Footer") { ((Label)e.Item.FindControl("lblTotalRequestedUSD")).Text = TotalRequestedUSD.ToString(); ((Label)e.Item.FindControl("lblTotalApprovedUSD")).Text = TotalApprovedUSD.ToString(); Button btnApproveClaims = (Button)e.Item.FindControl("btnApproveClaims"); Button btnRejectClaims = (Button)e.Item.FindControl("btnRejectClaims"); if (PendingCount > 0) { btnApproveClaims.Visible = true; btnRejectClaims.Visible = true; } else { btnApproveClaims.Visible = false; btnRejectClaims.Visible = false; } } }
private DataTable ValidateMin_Max() { DataTable dt = new DataTable("Options"); dt.Columns.Add("OptionText", typeof(string)); dt.Columns.Add("OptionValue", typeof(string)); decimal min = UDFLib.ConvertToDecimal(ddlMin.SelectedValue); decimal max = UDFLib.ConvertToDecimal(ddlMax.SelectedValue); int Division = UDFLib.ConvertToInteger(ddlDivisions.SelectedValue) - 1; if (min > max) { string js = "ShowAlert();"; ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", js, true); } if (min >= 0 && max > 0 && Division > 0) { decimal increment = (max - min) / Division; while (min <= max) { DataRow dr1 = dt.NewRow(); dr1[0] = min.ToString(); dr1[1] = min.ToString(); dt.Rows.Add(dr1); min += increment; } } return(dt); }
protected void cmdUpdteRefund_Click(object source, EventArgs e) { BLL_TRV_Refund objRefund = new BLL_TRV_Refund(); try { objRefund.UpdateRefund(UDFLib.ConvertToInteger(hdRefundID.Value), UDFLib.ConvertToDecimal(txtNoShowAmount.Text), UDFLib.ConvertToDecimal(txtCancellationAmount.Text), UDFLib.ConvertToDecimal(txtRefundAmount.Text), UDFLib.ConvertToDecimal(txtAmountReceived.Text), txtRefundRemark.Text, UDFLib.ConvertToInteger(Session["USERID"].ToString())); txtNoShowAmount.Text = ""; txtAmountReceived.Text = ""; txtCancellationAmount.Text = ""; txtRefundAmount.Text = ""; txtRefundRemark.Text = ""; string msgmodal = String.Format("hideModal('dvRefund');"); ScriptManager.RegisterStartupScript(Page, Page.GetType(), "refundclose", msgmodal, true); BindRefundList(); } catch { } finally { objRefund = null; } }
protected void btnExpToExl_Click(object sender, EventArgs e) { try { DataTable dt = BLL_PB_PortageBill.Get_PerMOAllotments(int.Parse(ddlFleet.SelectedValue) , int.Parse(ddlVessel.SelectedValue) , ddlMonth.SelectedValue , ddlYear.SelectedValue , int.Parse(ddlManningAgent.SelectedValue) , int.Parse(DDLBank.SelectedValue) , CrewID , Convert.ToInt32(ddlCountry.SelectedValue)); decimal iAmount = 0; foreach (DataRow row in dt.Rows) { iAmount = iAmount + UDFLib.ConvertToDecimal(row["Amount"]); } string[] HeaderCaptions = { "Vessel", "Staff Code", "Name", "Rank", "Seaman ID", "Manning Agent", "Account No.", "Beneficiary", "Bank Name", "PBDate", "Amount", "Currency" }; string[] DataColumnsName = { "vessel_short_name", "STAFF_CODE", "Staff_fullName", "Rank_Short_Name", "Seaman_Book_Number", "Company_Name", "BankAccId", "Beneficiary", "Bank_Name", "PBill_Date", "Amount", "Currency" }; GridViewExportUtil.ShowExcel(dt, HeaderCaptions, DataColumnsName, "ReportperManningAgent", "Report-per Manning Agent- Total Amount: " + iAmount.ToString("0.00"), ""); } catch (Exception ex) { } }
protected void btnAddNewItem_Click(object s, EventArgs e) { DataTable dtGridItems = new DataTable(); dtGridItems.Columns.Add("ID"); dtGridItems.Columns.Add("item_name"); dtGridItems.Columns.Add("amount"); dtGridItems.Columns.Add("remark"); DataRow dr = null; foreach (GridViewRow grItem in gvItemList.Rows) { dr = dtGridItems.NewRow(); dr["ID"] = ((HiddenField)grItem.FindControl("hdfID")).Value; dr["item_name"] = ((TextBox)grItem.FindControl("txtItem")).Text; dr["amount"] = UDFLib.ConvertToDecimal(((TextBox)grItem.FindControl("txtAmount")).Text); dr["remark"] = ((TextBox)grItem.FindControl("txtRemark")).Text; dtGridItems.Rows.Add(dr); } dr = dtGridItems.NewRow(); dr["ID"] = 0; dtGridItems.Rows.Add(dr); gvItemList.DataSource = dtGridItems; gvItemList.DataBind(); string CalculateTotal = String.Format("CalculateTotal();"); ScriptManager.RegisterStartupScript(Page, Page.GetType(), "CalculateTotal", CalculateTotal, true); }
protected void SaveInvoice() { BLL_TRV_Invoice objInvoice = new BLL_TRV_Invoice(); try { if (txtInvNo.Text.Trim() == "" || txtInvAmount.Text.Trim() == "" || txtInvDueDate.Text.Trim() == "") { Response.Write("<script type='text/javascript'>alert('Invoice Number, Amount and Due Date are MANDATORY');</script>"); } else { foreach (GridViewRow gvR in grdInvoice.Rows) { CheckBox chkSelect = ((CheckBox)gvR.FindControl("chkSelect")); HiddenField hdnRequestID = ((HiddenField)gvR.FindControl("hdnRequestID")); if (chkSelect != null && hdnRequestID != null) { if (chkSelect.Checked == true) { int RequestID = UDFLib.ConvertToInteger(hdnRequestID.Value); objInvoice.Save_Invoice(RequestID, txtInvNo.Text, Convert.ToDateTime(txtInvDueDate.Text), UDFLib.ConvertToDecimal(txtInvAmount.Text), cmbCurrency.SelectedValue, Convert.ToDateTime(txtInvDueDate.Text), UDFLib.ConvertToInteger(Session["USERID"].ToString()), txtInvoiceRemarks.Text); } } } } } catch { } finally { objInvoice = null; } }
protected void btnSave_Click(object sender, EventArgs e) { try { // rdoDeferToDrydock.Items[1].Selected = true; int Return_ID = 0; int retval = objBLLPurc.INSERT_ADHOC_JOB(UDFLib.ConvertToInteger(ViewState["Job_History_Id"]), UDFLib.ConvertToInteger(ViewState["OFFICE_ID"]), UDFLib.ConvertToInteger(ViewState["VESSEL_ID"]) , UDFLib.ConvertToInteger(ddlFunction.SelectedValue) , UDFLib.ConvertToInteger(ddlSysLocation.SelectedValue.ToString().Split(',')[0]) , UDFLib.ConvertToInteger(ddlSysLocation.SelectedValue.ToString().Split(',')[1]) , UDFLib.ConvertToInteger(ddlSubSystem_location.SelectedValue.ToString().Split(',')[1]) , UDFLib.ConvertToInteger(ddlSubSystem_location.SelectedValue.ToString().Split(',')[0]) , txtJobTitle.Text, txtJobDescription.Text , "PENDING", null , Convert.ToInt32(Session["userid"]) , UDFLib.ConvertIntegerToNull(ddlPIC.SelectedValue) , UDFLib.ConvertIntegerToNull(ddlAssignedBy.SelectedValue) , UDFLib.ConvertIntegerToNull(rdoDeferToDrydock.Items[0].Selected == true ? 1 : 0), ddlPriority.SelectedValue.ToString() , UDFLib.ConvertIntegerToNull(ddlInspector.SelectedValue) , UDFLib.ConvertDateToNull(txtInspectionDate.Text), UDFLib.ConvertIntegerToNull(ddlOnShip.SelectedValue) , UDFLib.ConvertIntegerToNull(ddlInOffice.SelectedValue) , UDFLib.ConvertDateToNull(txtExpectedComp.Text) , UDFLib.ConvertDateToNull(txtCompletedOn.Text) , UDFLib.ConvertToInteger(ddlPrimary.SelectedValue) , UDFLib.ConvertToInteger(ddlSecondary.SelectedValue) , UDFLib.ConvertToInteger(ddlPSCSIRE.SelectedValue) , cmbRequisition.SelectedValue , UDFLib.ConvertIntegerToNull(chkSafetyAlarm.Checked == true ? 1 : 0) , UDFLib.ConvertIntegerToNull(chkCalibration.Checked == true ? 1 : 0) , UDFLib.ConvertIntegerToNull(rbtnFunctional.Items[0].Selected == true ? 1 : 0) , ddlEffect.SelectedValue , UDFLib.ConvertToDecimal(txtbxSetPointDecimal.Text.Trim()) , int.Parse(ddlUnit.SelectedValue) , UDFLib.ConvertIntegerToNull(rbtnJobProcess.Items[0].Selected == true ? 1 : 0) , ref Return_ID ); ViewState["Job_History_Id"] = Return_ID; Session["Non_PMS_Job_History_Id"] = Return_ID; Session["Non_PMS_VESSEL_ID"] = ViewState["VESSEL_ID"]; ViewState["OFFICE_ID"] = 1; Session["Non_PMS_Office_ID"] = ViewState["OFFICE_ID"]; string js = "alert('Saved sucessfully!!');"; ScriptManager.RegisterStartupScript(this, this.GetType(), "savingJob", js, true); BindJobDetails(); } catch (Exception ex) { string js = "alert('Error in saving data!! Error: " + ex.Message + "');"; ScriptManager.RegisterStartupScript(this, this.GetType(), "errorsaving", js, true); } }
protected void btnApprove_Click(object sender, EventArgs e) { BLL_PURC_Purchase objApproval = new BLL_PURC_Purchase(); BLL_PURC_LOG.Ins_Log_Remark(Convert.ToInt32(Request.QueryString["LOG_ID"].ToString()), txtApproverRemark.Text, Convert.ToInt32(Session["USERID"]), 2); btnApprove.Enabled = false; SaveLPODetails(); DataTable dtSuppDate = BLL_PURC_Common.Get_Supplier_ValidDate("'" + uc_SupplierList1.SelectedValue + "'"); if (dtSuppDate.Rows.Count > 0) { if (Convert.ToDateTime(dtSuppDate.Rows[0]["ASL_Status_Valid_till"]) < DateTime.Now) { String msg = String.Format("alert('Selected Supplier has been expired/blacklisted');"); ScriptManager.RegisterStartupScript(Page, Page.GetType(), "msg451", msg, true); } else { decimal TotalAmountToApproved = UDFLib.ConvertToDecimal(hdf_TotalAmount_USD.Value); ViewState["TotalAmountToApproved"] = TotalAmountToApproved; /*Below code is commented due to this JIT_8823 as below method checks for department as it doesnt required for Logistic Po.*/ //DataTable dtApproval = objApproval.Get_Approval_Limit(Convert.ToInt32(Session["USERID"]), ViewState["Dept_Code"].ToString()); decimal Applimit = BLL_PURC_LOG.Get_Log_Logistic_Approval_Limit(Convert.ToInt32(Session["USERID"])); //decimal Applimit = decimal.Parse(dtApproval.Rows[0]["Approval_Limit"].ToString()); if (Applimit < 1) { string msgmodal = String.Format("alert('Approval limit not found !')"); ScriptManager.RegisterStartupScript(Page, Page.GetType(), "Apprmodal", msgmodal, true); } else if (Applimit >= TotalAmountToApproved) { BLL_PURC_LOG.Ins_Log_Logistic_Approval_Entry(Convert.ToInt32(Session["USERID"].ToString()), Convert.ToInt32(Session["USERID"].ToString()), TotalAmountToApproved, Convert.ToInt32(Request.QueryString["LOG_ID"].ToString()), "", txtApproverRemark.Text, 1); string msgmodal = String.Format("alert('Approved successfully');parent.ReloadParent_ByButtonID();"); ScriptManager.RegisterStartupScript(Page, Page.GetType(), "Apprmodala", msgmodal, true); } else { ViewState["islimit<Total"] = 1; string msgmodal = String.Format("showModal('divSendForApproval');alert('The total PO amount is beyond your approval limit.Please forward to one of the following for approval')"); ScriptManager.RegisterStartupScript(Page, Page.GetType(), "Apprmodal", msgmodal, true); } } } }
/// <summary> /// Sent for Approval /// </summary> public void OnStsSaved(object s, EventArgs e) { try { TechnicalBAL objTechBAL = new TechnicalBAL(); string QuotationCode = ""; string SupplierCode = ""; decimal Supp_Total_Amount = 0; decimal approvedAmount = 0; dicTotalAmount.Clear(); DataTable dtQuotationList = new DataTable(); dtQuotationList.Columns.Add("Qtncode"); dtQuotationList.Columns.Add("amount"); CheckBox Chk = new CheckBox(); foreach (GridViewRow gr in Grid_RqsnDtl.Rows) { Chk = (CheckBox)gr.FindControl("Chk_Item"); if (Chk.Checked) { Label lbl_Qnty = (Label)gr.FindControl("lbl_TotalPrice"); approvedAmount = Convert.ToDecimal(lbl_Qnty.Text) + approvedAmount; } } approvedAmount = approvedAmount + Convert.ToDecimal(hdfOrderAmounts.Value); SupplierCode = hdfSupplierBeingApproved.Value; QuotationCode = hdfQTNCode.Value; Supp_Total_Amount = UDFLib.ConvertToDecimal(lbl_TotalAmount.Text); DataRow dtrow = dtQuotationList.NewRow(); dtrow[0] = QuotationCode; dtrow[1] = dicTotalAmount[QuotationCode].ToString(); dtQuotationList.Rows.Add(dtrow); // first send for approval int stsEntry = objTechBAL.InsertUserApprovalEntries(Requisitioncode, Document_Code, Vessel_Code, User, ucApprovalUser1.ApproverID, 0, 0, "", ucApprovalUser1.Remark, dtQuotationList); // save the approval objTechBAL.InsertUserApprovalEntries(Requisitioncode, Document_Code, Vessel_Code, User, User, Supp_Total_Amount, approvedAmount, "0", txtComment.Text.Trim(), dtQuotationList); String msg1 = String.Format("alert('Sent successfully.'); RefreshPendingDetails();window.close();"); ScriptManager.RegisterStartupScript(Page, Page.GetType(), "msgSENT", msg1, true); } catch (Exception ex) { UDFLib.WriteExceptionLog(ex); } }
protected void btnApproveClaims_Click(object sender, EventArgs e) { int QueryID = UDFLib.ConvertToInteger(Request.QueryString["ID"]); int Vessel_ID = UDFLib.ConvertToInteger(Request.QueryString["VID"]); Repeater rptClaims = ((Repeater)frmDetails.FindControl("rptClaims")); decimal Req_USD = 0; decimal Apr_USD = 0; DataTable Claims = new DataTable(); Claims.Columns.Add("PID", typeof(int)); Claims.Columns.Add("VALUE", typeof(string)); foreach (RepeaterItem oItem in rptClaims.Items) { if (oItem.ItemType.ToString() == "Item" || oItem.ItemType.ToString() == "AlternatingItem") { CheckBox chkApproval = (CheckBox)oItem.FindControl("chkApproval"); Label lblRequestedUSD = (Label)oItem.FindControl("lblRequestedUSD"); TextBox txtApprovedUSD = (TextBox)oItem.FindControl("txtApprovedUSD"); HiddenField hdnClaimID = (HiddenField)oItem.FindControl("hdnClaimID"); if (chkApproval != null) { if (chkApproval.Checked == true) { if (lblRequestedUSD != null) { Req_USD = UDFLib.ConvertToDecimal(lblRequestedUSD.Text); } if (lblRequestedUSD != null) { Apr_USD = UDFLib.ConvertToDecimal(txtApprovedUSD.Text); } if (hdnClaimID != null) { Claims.Rows.Add(UDFLib.ConvertToInteger(hdnClaimID.Value), Apr_USD); } } } } } if (Claims.Rows.Count > 0) { int Res = BLL_Crew_Queries.Approve_CrewQuery_Claims(QueryID, Vessel_ID, Claims, GetSessionUserID()); Load_Crew_Query_Details(); if (Res > 0) { string js = "alert('Selected claims approved !!)"; ScriptManager.RegisterStartupScript(this, this.GetType(), "initscript1", js, true); } } }
protected void gvAllotments_RowUpdating(object sender, GridViewUpdateEventArgs e) { BLL_PB_PortageBill.Update_Allotment(Convert.ToInt32(e.Keys["Vessel_ID"]), Convert.ToInt32(e.Keys["AllotmentID"]), UDFLib.ConvertToDecimal(((TextBox)gvAllotments.Rows[e.RowIndex].FindControl("txtAllotmentAmount")).Text), Convert.ToInt32(((DropDownList)gvAllotments.Rows[e.RowIndex].FindControl("ddlAccount")).SelectedValue), Convert.ToInt32(Session["userid"])); gvAllotments.EditIndex = -1; Load_Allotments(); }
protected void SaveItemPrice() { DataTable dtItemPrice = new DataTable(); dtItemPrice.Columns.Add("pkid", typeof(int)); dtItemPrice.Columns.Add("rate", typeof(decimal)); dtItemPrice.Columns.Add("discount", typeof(decimal)); dtItemPrice.Columns.Add("unit", typeof(string)); dtItemPrice.Columns.Add("supp_remark"); DataRow dr; foreach (GridViewRow gr in gvContractDetails.Rows) { dr = dtItemPrice.NewRow(); dr["pkid"] = Convert.ToInt32(((TextBox)gr.FindControl("txtrate")).ToolTip.Trim()); dr["rate"] = UDFLib.ConvertToDecimal(((TextBox)gr.FindControl("txtrate")).Text.Trim()); dr["discount"] = UDFLib.ConvertToDecimal(((TextBox)gr.FindControl("txtDiscount")).Text.Trim()); dr["unit"] = ((TextBox)gr.FindControl("lbtnUnitsPKg")).Text.Trim(); dtItemPrice.Rows.Add(dr); } DataTable dtCharges = new DataTable(); dtCharges.Columns.Add("Currency"); dtCharges.Columns.Add("Truck_Charge"); dtCharges.Columns.Add("Barge_Charge"); dtCharges.Columns.Add("Freight_Charge"); dtCharges.Columns.Add("Pkg_Hld_Charge"); dtCharges.Columns.Add("Other_Charge"); dtCharges.Columns.Add("Vat"); dtCharges.Columns.Add("Discount"); DataRow drCharges = dtCharges.NewRow(); drCharges["Currency"] = UDFLib.ConvertStringToNull(DDLCurrency.SelectedItem.Text.Trim()); drCharges["Truck_Charge"] = UDFLib.ConvertDecimalToNull(txtTruckCharge.Text); drCharges["Barge_Charge"] = UDFLib.ConvertDecimalToNull(txtBargeCharge.Text); drCharges["Freight_Charge"] = UDFLib.ConvertDecimalToNull(txtFrieghtCharge.Text); drCharges["Pkg_Hld_Charge"] = UDFLib.ConvertDecimalToNull(txtPkgCharge.Text); drCharges["Other_Charge"] = UDFLib.ConvertDecimalToNull(txtOtherCharge.Text); drCharges["Vat"] = UDFLib.ConvertDecimalToNull(txtVat.Text); drCharges["Discount"] = UDFLib.ConvertDecimalToNull(txtDiscount.Text); dtCharges.Rows.Add(drCharges); if (dtItemPrice.Rows.Count > 0) { BLL_PURC_CTP.Upd_Ctp_Items_Price(Convert.ToInt32(Request.QueryString["Quotation_ID"]), dtItemPrice, Convert.ToInt32(Session["userid"].ToString()), isfinalizing, dtCharges); } }
protected void gvCTMCalculations_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { decimal rowTotal = UDFLib.ConvertToDecimal(DataBinder.Eval(e.Row.DataItem, "CashCategory_Amt").ToString()); CTMTotal = CTMTotal + rowTotal; } if (e.Row.RowType == DataControlRowType.Footer) { //Label lbl = (Label)e.Row.FindControl("lblTotal"); lblCTMTotal.Text = CTMTotal.ToString("$ ###,##0.00"); } }
protected void GridView_Crew_RowDataBound(object sender, GridViewRowEventArgs e) { string Remarks; Image ImgRemarks = (Image)e.Row.FindControl("ImgRemarks"); if (ImgRemarks != null) { Remarks = "Approved By:" + DataBinder.Eval(e.Row.DataItem, "ApprovedBy").ToString() + "<br>Date : " + DataBinder.Eval(e.Row.DataItem, "Approved_Date", "{0:dd/MM/yyyy}").ToString() + "<br>"; if (DataBinder.Eval(e.Row.DataItem, "Remarks") != null) { Remarks += "Remarks: " + DataBinder.Eval(e.Row.DataItem, "Remarks").ToString().Replace("\n", "<br>"); } ImgRemarks.Attributes.Add("Title", "cssbody=[dvbdy1] cssheader=[dvhdr1] header=[Remarks:] body=[" + Remarks + "]"); } Label lblDueAmt = (Label)e.Row.FindControl("lblDueAmt"); if (lblDueAmt != null) { DueTotal += UDFLib.ConvertToDecimal(lblDueAmt.Text); } HiddenField hdnApprovedAmt = (HiddenField)e.Row.FindControl("hdnApprovedAmt"); if (hdnApprovedAmt != null) { ApprovedTotal += UDFLib.ConvertToDecimal(hdnApprovedAmt.Value); } if (e.Row.RowType == DataControlRowType.Footer) { Label lblDueTotal = (Label)e.Row.FindControl("lblDueTotal"); if (lblDueTotal != null) { lblDueTotal.Text = DueTotal.ToString(); } Label lblApprovedTotal = (Label)e.Row.FindControl("lblApprovedTotal"); if (lblApprovedTotal != null) { lblApprovedTotal.Text = ApprovedTotal.ToString(); } } if (DataBinder.Eval(e.Row.DataItem, "Joining_Type") != null) { int Joining_Type = UDFLib.ConvertToInteger(DataBinder.Eval(e.Row.DataItem, "Joining_Type").ToString()); if (Joining_Type == 4) { e.Row.CssClass = "Promoted-Voyage-Row"; } } }
protected int SaveLPODetails() { DataTable dtGridItems = new DataTable(); dtGridItems.Columns.Add("PID"); dtGridItems.Columns.Add("Item_ID"); dtGridItems.Columns.Add("item"); dtGridItems.Columns.Add("amount"); dtGridItems.Columns.Add("remark"); dtGridItems.Columns.Add("vessel_id"); dtGridItems.PrimaryKey = new DataColumn[] { dtGridItems.Columns["PID"] }; DataRow dr = null; int RowID = 1; foreach (GridViewRow grItem in gvItemList.Rows) { dr = dtGridItems.NewRow(); dr["PID"] = RowID++; dr["Item_ID"] = ((HiddenField)grItem.FindControl("hdfID")).Value; dr["item"] = ((TextBox)grItem.FindControl("txtItem")).Text; dr["amount"] = UDFLib.ConvertToDecimal(((TextBox)grItem.FindControl("txtAmount")).Text); dr["remark"] = ((TextBox)grItem.FindControl("txtRemark")).Text; dr["vessel_id"] = (grItem.FindControl("ddlpovessels") as DropDownList).SelectedValue; //if (dtGridItems.Rows.Contains(dr["vessel_id"].ToString()) || dr["vessel_id"].ToString() == "0") //{ // lblMessage.Visible = true; // lblMessage.Text = "Same vessel can not be selected more than one time . Please select different vessel for each row."; // return 0; //} if (dr["item"].ToString().Trim() == "") { lblMessage.Visible = true; lblMessage.Text = "Please enter item details ."; return(0); } if (Convert.ToDecimal(dr["amount"].ToString()) < 1) { lblMessage.Visible = true; lblMessage.Text = "Amount should be greater than zero !"; return(0); } dtGridItems.Rows.Add(dr); } return(BLL_PURC_LOG.Ins_Log_LogisticPO_Details(UDFLib.ConvertToInteger(Request.QueryString["LOG_ID"]), DDLCurrency.SelectedItem.Text, rbtnlistPOType.SelectedValue, rbtnlistCostType.SelectedValue, ddlHub.SelectedValue, ddlAgentFord.SelectedValue, UDFLib.ConvertToInteger(ctlPortList1.SelectedValue), "", dtGridItems, Convert.ToInt32(Session["USERID"].ToString()), uc_SupplierList1.SelectedValue)); }
protected void rptCostItems_ItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType.ToString() == "Item" || e.Item.ItemType.ToString() == "AlternatingItem") { TotalUSDAmt += UDFLib.ConvertToDecimal(DataBinder.Eval(e.Item.DataItem, "USD_Amount").ToString()); TotalLocalAmt += UDFLib.ConvertToDecimal(DataBinder.Eval(e.Item.DataItem, "Local_Amount").ToString()); } if (e.Item.ItemType.ToString() == "Footer") { ((Label)e.Item.FindControl("lblTotal")).Text = TotalLocalAmt.ToString(); ((Label)e.Item.FindControl("lblTotalUSD")).Text = TotalUSDAmt.ToString(); } }
protected void btnSaveGrade_Click(object sender, EventArgs e) { try { int ID = objBLL.INSERT_Grading(txtGrade.Text.Trim(), UDFLib.ConvertToInteger(rdoGradeType.SelectedValue), UDFLib.ConvertToInteger(ddlMin.SelectedValue), UDFLib.ConvertToInteger(ddlMax.SelectedValue), UDFLib.ConvertToInteger(ddlDivisions.SelectedValue), GetSessionUserID()); // int ID = BLL_Crew_Evaluation.INSERT_Grading(txtGrade.Text.Trim(), UDFLib.ConvertToInteger(rdoGradeType.SelectedValue), UDFLib.ConvertToInteger(ddlMin.SelectedValue), UDFLib.ConvertToInteger(ddlMax.SelectedValue), UDFLib.ConvertToInteger(ddlDivisions.SelectedValue), GetSessionUserID()); if (ID > 0) { txtGrade.Text = ""; ddlMin.SelectedIndex = 0; ddlMax.SelectedIndex = 0; ddlDivisions.SelectedIndex = 0; dvrpt.Style.Add("display", "none"); for (int i = 0; i < rptOptions.Items.Count; i++) { TextBox txtValue = (TextBox)rptOptions.Items[i].FindControl("txtValue"); TextBox txtText = (TextBox)rptOptions.Items[i].FindControl("txtText"); if (txtText != null && txtValue != null) { objBLL.INSERT_GradingOption(ID, txtText.Text.Trim(), UDFLib.ConvertToDecimal(txtValue.Text), GetSessionUserID()); //BLL_Crew_Evaluation.INSERT_GradingOption(ID, txtText.Text.Trim(), UDFLib.ConvertToDecimal(txtValue.Text), GetSessionUserID()); } } Load_GradingList(); BindMin(); BindMax(); string jsPrompt1 = "alert('Grade saved successfully');"; ScriptManager.RegisterStartupScript(this, this.GetType(), "jsPrompt1", jsPrompt1, true); } else { string jsPrompt1 = "alert('Grade name already exists');"; ScriptManager.RegisterStartupScript(this, this.GetType(), "jsPrompt1", jsPrompt1, true); } } catch (SqlException sqlEx) { string jsSqlError = "alert('" + sqlEx.Message + "');"; ScriptManager.RegisterStartupScript(this, this.GetType(), "jsSqlError", jsSqlError, true); } catch (Exception Ex) { } }
/// <summary> /// Modified by Anjali DT:4-jun-2016|| JIT:9718 /// To display options/Values on selection of Min point ,Max point and Options. /// </summary> /// <remarks> /// e.g Min point = 1 /// Max point = 2 /// No of options = 3 /// As per input Grade will be created as followes: /// 1. Grade will be divided in 3 options. /// 2. Min point will be 1. /// 3. Min point will be incremented by : Math.Round((max - min) / (Division-1), 4) .i.e Math.Round((2 - 1) / (3-1), 4) = 0.5 /// 4. Second value will be 1.5, as '0.5' value will be added to Min point i.e 1 + 0.5 = 1.5. /// 5. For third value 0.5 will be added to 1.5 + 0.5 = 2.0 is third value. /// 6. Again Min will incremented by 0.5 ie. 2.0 + 0.5 =2.5. /// 6. Now loop will break as Min is greater than Max value. /// 7.O/P will be as follows as per selection . /// Value Text /// 1 1 /// 1.5 1.5 /// 2.0 2.0 /// </summary> private void ShowOptions() { decimal min = UDFLib.ConvertToDecimal(ddlMin.SelectedValue); decimal max = UDFLib.ConvertToDecimal(ddlMax.SelectedValue); int Division = UDFLib.ConvertToInteger(ddlDivisions.SelectedValue) - 1; try { DataTable dt = new DataTable("Options"); dt.Columns.Add("OptionText", typeof(string)); dt.Columns.Add("OptionValue", typeof(string)); if (ValidateData(false)) // Added by anjali DT:04-Jun-2016 { decimal increment = Math.Round((max - min) / Division, 4); while (min <= max) { DataRow dr1 = dt.NewRow(); dr1[0] = min.ToString(); dr1[1] = min.ToString(); dt.Rows.Add(dr1); min += increment; } if (dt.Rows.Count < Convert.ToInt32(ddlDivisions.SelectedValue)) { DataRow dr1 = dt.NewRow(); dr1[0] = max.ToString(); dr1[1] = max.ToString(); dt.Rows.Add(dr1); } rptOptions.DataSource = dt; rptOptions.DataBind(); dvrpt.Style.Add("display", "block"); } else { dvrpt.Style.Add("display", "none"); } } catch (Exception ex) { throw ex; } }
protected void btnSaveGrade_Click(object sender, EventArgs e) { int ID = OPS_Admin.INSERT_Grading(txtGrade.Text.Trim(), UDFLib.ConvertToInteger(rdoGradeType.SelectedValue), UDFLib.ConvertToInteger(ddlMin.SelectedValue), UDFLib.ConvertToInteger(ddlMax.SelectedValue), UDFLib.ConvertToInteger(ddlDivisions.SelectedValue), GetSessionUserID()); txtGrade.Text = ""; for (int i = 0; i < rptOptions.Items.Count; i++) { TextBox txtValue = (TextBox)rptOptions.Items[i].FindControl("txtValue"); TextBox txtText = (TextBox)rptOptions.Items[i].FindControl("txtText"); if (txtText != null && txtValue != null) { OPS_Admin.INSERT_GradingOption(ID, txtText.Text.Trim(), UDFLib.ConvertToDecimal(txtValue.Text), GetSessionUserID()); } } Load_GradingList(); }
protected void amount_text_changed(object sender, EventArgs e) { TextBox txt = (TextBox)sender; decimal v1 = UDFLib.ConvertToDecimal(txt.CssClass); decimal v2 = UDFLib.ConvertToDecimal(txt.Text); if (v2 < v1) { txt.BackColor = System.Drawing.Color.Red; txt.ForeColor = System.Drawing.Color.White; } else { txt.BackColor = System.Drawing.Color.White; txt.ForeColor = System.Drawing.Color.Black; } }
protected void CalculateMarks(int InterviewID) { decimal UserMarks = 0; decimal FullMark = 0; decimal Avg = 0; string js = ""; DataSet dsQA = BLL_Crew_Interview.Get_InterviewQuestionAnswers(InterviewID, GetSessionUserID()); foreach (DataRow dr in dsQA.Tables[0].Rows) { if (UDFLib.ConvertToDecimal(dr["NotApplicable"].ToString()) == 0) { FullMark += UDFLib.ConvertToDecimal(dr["Max"].ToString()); UserMarks += UDFLib.ConvertToDecimal(dr["UserAnswer"].ToString()); if (FullMark > 0) { Avg = UserMarks / FullMark * 100; } } } lblMaxMarks.Text = FullMark.ToString(); lblUserMarks_P.Text = Avg.ToString("0.0"); lblUserMarks.Text = UserMarks.ToString("0.0"); if (FullMark > 0) { lblOutOf5.Text = (UserMarks / FullMark * 5).ToString("0.0"); if ((UserMarks / FullMark * 5) > 2) { js = "setDotColor('green');"; } else { js = "setDotColor('red');"; } } else { lblOutOf5.Text = "0.0"; js = "setDotColor('red');"; } ScriptManager.RegisterStartupScript(this, this.GetType(), "setDotColor_", js, true); }
/// <summary> /// Added by Anjali DT:16-06-2016 /// To save grades. /// </summary> private void SaveGrades() { try { int ID = objBLL.INSERT_Grading(txtGrade.Text.Trim(), UDFLib.ConvertToInteger(rdoGradeType.SelectedValue), UDFLib.ConvertToInteger(ddlMin.SelectedValue), UDFLib.ConvertToInteger(ddlMax.SelectedValue), UDFLib.ConvertToInteger(ddlDivisions.SelectedValue), GetSessionUserID()); if (ID > 0) { txtGrade.Text = ""; ddlMin.SelectedIndex = 0; ddlMax.SelectedIndex = 0; ddlDivisions.SelectedIndex = 0; dvrpt.Style.Add("display", "none"); for (int i = 0; i < rptOptions.Items.Count; i++) { TextBox txtValue = (TextBox)rptOptions.Items[i].FindControl("txtValue"); TextBox txtText = (TextBox)rptOptions.Items[i].FindControl("txtText"); if (txtText != null && txtValue != null) { objBLL.INSERT_GradingOption(ID, txtText.Text.Trim(), UDFLib.ConvertToDecimal(txtValue.Text), GetSessionUserID()); } } Load_GradingList(); BindMin(); BindMax(); string jsPrompt1 = "alert('Grade saved successfully.');"; ScriptManager.RegisterStartupScript(this, this.GetType(), "jsPrompt1", jsPrompt1, true); } else { string jsPrompt1 = "alert('Grade name already exists.');"; ScriptManager.RegisterStartupScript(this, this.GetType(), "jsPrompt1", jsPrompt1, true); } } catch (SqlException sqlEx) { UDFLib.WriteExceptionLog(sqlEx); } catch (Exception Ex) { UDFLib.WriteExceptionLog(Ex); } }
protected void imgbtnDeleteitem_Click(object sender, EventArgs e) { if (gvItemList.Rows.Count > 1) { GridViewRow dritem = (GridViewRow)(sender as ImageButton).Parent.Parent; DataTable dtGridItems = new DataTable(); dtGridItems.Columns.Add("Item_ID"); dtGridItems.Columns.Add("item"); dtGridItems.Columns.Add("amount"); dtGridItems.Columns.Add("remark"); dtGridItems.Columns.Add("vessel_id"); dtGridItems.Columns.Add("Item_PO"); int RowID = 0; DataRow dr = null; foreach (GridViewRow grItem in gvItemList.Rows) { if (dritem.RowIndex != RowID) { dr = dtGridItems.NewRow(); dr["Item_ID"] = ((HiddenField)grItem.FindControl("hdfID")).Value; dr["item"] = ((TextBox)grItem.FindControl("txtItem")).Text; dr["amount"] = UDFLib.ConvertToDecimal(((TextBox)grItem.FindControl("txtAmount")).Text); dr["remark"] = ((TextBox)grItem.FindControl("txtRemark")).Text; dr["vessel_id"] = (grItem.FindControl("ddlpovessels") as DropDownList).SelectedValue; dtGridItems.Rows.Add(dr); } RowID++; } //delete from database if (!Convert.ToBoolean(ViewState["IsCreatingNewPO"])) { BLL_PURC_LOG.Upd_Log_LogisticPO_Item(Convert.ToInt32((dritem.FindControl("hdfID") as HiddenField).Value), Convert.ToInt32(Session["USERID"])); } gvItemList.DataSource = dtGridItems; gvItemList.DataBind(); ViewState["vsItemList"] = dtGridItems; } string CalculateTotal = String.Format("CalculateTotal();"); ScriptManager.RegisterStartupScript(Page, Page.GetType(), "CalculateTotal", CalculateTotal, true); }
protected void GridView_ProcessingFee_RowUpdating(object sender, GridViewUpdateEventArgs e) { try { int ManningOfficeID = UDFLib.ConvertToInteger(GridView_ProcessingFee.DataKeys[e.RowIndex].Values["ID"].ToString()); decimal Amount_VMT = UDFLib.ConvertToDecimal(GridView_ProcessingFee.DataKeys[e.RowIndex].Values[1].ToString()); decimal Amount_Jnr = UDFLib.ConvertToDecimal(GridView_ProcessingFee.DataKeys[e.RowIndex].Values[3].ToString()); decimal Amount_Rat = UDFLib.ConvertToDecimal(GridView_ProcessingFee.DataKeys[e.RowIndex].Values[5].ToString()); DateTime?VMT_EffectiveDate = UDFLib.ConvertDateToNull(GridView_ProcessingFee.DataKeys[e.RowIndex].Values[2].ToString()); DateTime?Jnr_EffectiveDate = UDFLib.ConvertDateToNull(GridView_ProcessingFee.DataKeys[e.RowIndex].Values[4].ToString()); DateTime?Rat_EffectiveDate = UDFLib.ConvertDateToNull(GridView_ProcessingFee.DataKeys[e.RowIndex].Values[6].ToString()); TextBox txtAmount_VMT = (TextBox)GridView_ProcessingFee.Rows[e.RowIndex].FindControl("txtAF_Officers"); TextBox txtDate_VMT = (TextBox)GridView_ProcessingFee.Rows[e.RowIndex].FindControl("txtEffectiveDate"); TextBox txtAmount_Jnr = (TextBox)GridView_ProcessingFee.Rows[e.RowIndex].FindControl("txtAF_Officers_Jnr"); TextBox txtDate_Jnr = (TextBox)GridView_ProcessingFee.Rows[e.RowIndex].FindControl("txtAF_Officers_Jnr_Effdt"); TextBox txtAmount_Rat = (TextBox)GridView_ProcessingFee.Rows[e.RowIndex].FindControl("txtAF_Ratings"); TextBox txtDate_Rat = (TextBox)GridView_ProcessingFee.Rows[e.RowIndex].FindControl("txtAF_Ratings_Effdt"); if (Amount_VMT != UDFLib.ConvertToDecimal(txtAmount_VMT.Text) || VMT_EffectiveDate != UDFLib.ConvertDateToNull(txtDate_VMT.Text)) { BLL_Crew_Disbursement.UPDATE_MODisbursementFee_DL(ManningOfficeID, 2, UDFLib.ConvertToDecimal(txtAmount_VMT.Text), UDFLib.ConvertToInteger(txtAmount_VMT.ToolTip), txtDate_VMT.Text, GetSessionUserID(), 1); } if (Amount_Jnr != UDFLib.ConvertToDecimal(txtAmount_Jnr.Text) || Jnr_EffectiveDate != UDFLib.ConvertDateToNull(txtDate_Jnr.Text)) { BLL_Crew_Disbursement.UPDATE_MODisbursementFee_DL(ManningOfficeID, 2, UDFLib.ConvertToDecimal(txtAmount_Jnr.Text), UDFLib.ConvertToInteger(txtAmount_Jnr.ToolTip), txtDate_Jnr.Text, GetSessionUserID(), 2); } if (Amount_Rat != UDFLib.ConvertToDecimal(txtAmount_Rat.Text) || Rat_EffectiveDate != UDFLib.ConvertDateToNull(txtDate_Rat.Text)) { BLL_Crew_Disbursement.UPDATE_MODisbursementFee_DL(ManningOfficeID, 2, UDFLib.ConvertToDecimal(txtAmount_Rat.Text), UDFLib.ConvertToInteger(txtAmount_Rat.ToolTip), txtDate_Rat.Text, GetSessionUserID(), 3); } GridView_ProcessingFee.EditIndex = -1; Load_ProcessingFee(); } catch { } }
protected void SaveItem() { int Vessel_ID = UDFLib.ConvertToInteger(ddlVesselFilter.SelectedValue); int PacketID = UDFLib.ConvertToInteger(ddlVesselPackets.SelectedValue); decimal Item_Qty = UDFLib.ConvertToDecimal(txtQty.Text); int ItemID = BLL_Crew_CrewMail.INSERT_CrewMailItem(Vessel_ID, txtRefNo.Text, txtDesc.Text, Item_Qty, txtRemarks.Text, UDFLib.ConvertUserDateFormat(txtDatePlaced.Text.ToString()), GetSessionUserID()); if (chkAddToPacket.Checked == true) { BLL_Crew_CrewMail.AddItemTo_Packet(Vessel_ID, PacketID, ItemID, GetSessionUserID()); } txtRefNo.Text = ""; txtDesc.Text = ""; txtRemarks.Text = ""; txtQty.Text = ""; }