public void BindItems()
    {
        if (IsPostBack)
        {
            SaveItemsSelection();
        }


        int is_fetch_count = ucCustomPager1.isCountRecord;

        gvNonContractItems.DataSource = BLL_PURC_CTP.Get_Ctp_Non_Contract_Items(UDFLib.ConvertDateToNull(txtReqsnDTFrom.Text)
                                                                                , UDFLib.ConvertDateToNull(txtReqsnDTTo.Text)
                                                                                , UDFLib.ConvertStringToNull(ddlSubCatalogue.SelectedValue)
                                                                                , ddlCatalogue.SelectedValue
                                                                                , ucCustomPager1.CurrentPageIndex
                                                                                , ucCustomPager1.PageSize
                                                                                , ref is_fetch_count
                                                                                , null
                                                                                , null
                                                                                );
        gvNonContractItems.DataBind();
        if (ucCustomPager1.isCountRecord == 1)
        {
            ucCustomPager1.CountTotalRec = is_fetch_count.ToString();
            ucCustomPager1.BuildPager();
        }
    }
    protected void btnSaveToExistingCtp_Click(object sender, EventArgs e)
    {
        try
        {
            DataTable dtSelected = (DataTable)ViewState["vsdtSelected_Items"];

            DataTable dtSelected_SubCatalogue = new DataTable();
            dtSelected_SubCatalogue.Columns.Add("id");

            DataTable vsdtSelected_SubCatalogue_items = new DataTable();
            vsdtSelected_SubCatalogue_items.Columns.Add("id");

            int Quotation_ID = Convert.ToInt32(gvContractList_qtn.SelectedDataKey.Value.ToString());

            int sts = BLL_PURC_CTP.Insert_Ctp_QuotationItems(Quotation_ID, dtSelected, dtSelected_SubCatalogue, vsdtSelected_SubCatalogue_items, Convert.ToInt32(Session["userid"].ToString()));
            if (sts > 0)
            {
                String msg1 = String.Format("alert('Items added successfully.');window.open('','_self','');window.close();");
                ScriptManager.RegisterStartupScript(Page, Page.GetType(), "msg43476", msg1, true);
            }
        }
        catch (Exception ex)
        {
            lblmsg.Text = ex.Message;
        }
    }
예제 #3
0
    protected void btnSaveItems_Click(object sender, EventArgs e)
    {
        try
        {
            if (Quotation_ID == -1 && Contract_ID < 1)
            {
                int sts = BLL_PURC_CTP.Insert_Ctp_CreateNewContract(Catalogue_code, Dept_ID, (DataTable)ViewState["vsdtSelected_Items"], (DataTable)ViewState["vsdtSelected_SubCatalogue"], (DataTable)ViewState["vsdtSelected_SubCatalogue_items"], Convert.ToInt32(Session["userid"].ToString()));
                if (sts > -1)
                {
                    btnSaveItems.Enabled  = false;
                    AddItems_Saved_Status = true;
                    btnCancel.Enabled     = false;

                    Contract_ID = sts;
                }
            }
            else if (Quotation_ID > 0 || Contract_ID > 0)
            {
                int sts = BLL_PURC_CTP.Insert_Ctp_QuotationItems(Quotation_ID, (DataTable)ViewState["vsdtSelected_Items"], (DataTable)ViewState["vsdtSelected_SubCatalogue"], (DataTable)ViewState["vsdtSelected_SubCatalogue_items"], Convert.ToInt32(Session["userid"].ToString()), Contract_ID);
            }
        }
        catch (Exception ex)
        {
        }
    }
    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);
    }
    private void BindContractInfo()
    {
        DataTable dtInfo = BLL_PURC_CTP.Get_Ctp_Contract_Info(Convert.ToInt32(Request.QueryString["Quotation_ID"]), Convert.ToInt32(Request.QueryString["Contract_ID"]));

        if (dtInfo.Rows.Count > 0 && Convert.ToInt32(Request.QueryString["Quotation_ID"]) > 0)
        {
            lblApprovedBy.Text  = dtInfo.Rows[0]["ApprovedBy"].ToString();
            lblApprovedDT.Text  = dtInfo.Rows[0]["Approved_Date"].ToString();
            lblCatalogue.Text   = dtInfo.Rows[0]["System_Description"].ToString();
            lblCurrentSts.Text  = dtInfo.Rows[0]["QTN_STS"].ToString();
            lblDepartment.Text  = dtInfo.Rows[0]["Dept_Name"].ToString();
            lblEffectiveDT.Text = dtInfo.Rows[0]["Effective_Date"].ToString();
            lblPort.Text        = dtInfo.Rows[0]["PORT_NAME"].ToString();
            //lblRejectedDT.Text = dtInfo.Rows[0]["ApprovedBy"].ToString();
            lblSeachangeRef.Text    = dtInfo.Rows[0]["QTN_Contract_Code"].ToString();
            lblSentToSuppDT.Text    = dtInfo.Rows[0]["RFQ_Sent_Date"].ToString();
            lblSubmittedBySupp.Text = dtInfo.Rows[0]["QTN_Received_Date"].ToString();;
            lblSupplierName.Text    = dtInfo.Rows[0]["Full_NAME"].ToString();
            lblSupplierRef.Text     = dtInfo.Rows[0]["Supplier_Ref_Number"].ToString();
            imgApprovedByRmk.Attributes.Add("Title", "cssbody=[dvbdy1] cssheader=[dvhdr1] header=[ ] body=[" + dtInfo.Rows[0]["approver_remark"].ToString() + "]");

            hlnkAddItem.Attributes.Add("onclick", "OpenPopupWindowBtnID('POP__IDAddItem', 'Add/modify contract item', 'CTP_Quotation_Items_PopUp.aspx?Dept_ID=" + dtInfo.Rows[0]["Dept_ID"].ToString() + "&Catalogue_code=" + dtInfo.Rows[0]["Catalogue"].ToString() + "&Catalogue_Name=" + dtInfo.Rows[0]["System_Description"].ToString() + "&DepartmentName=" + dtInfo.Rows[0]["Dept_Name"].ToString() + "&Quotation_ID=" + Request.QueryString["Quotation_ID"] + " ','popup',800,1500,40,40,true,true,true,false,'" + btnSearch.ClientID + "'); return false;");

            BindSubCatalogue(dtInfo.Rows[0]["Catalogue"].ToString());
        }
        else
        {
            hlnkAddItem.Attributes.Add("onclick", "OpenPopupWindowBtnID('POP__IDAddItem', 'Add/modify contract item', 'CTP_Quotation_Items_PopUp.aspx?Dept_ID=" + dtInfo.Rows[0]["Dept_ID"].ToString() + "&Catalogue_code=" + dtInfo.Rows[0]["Catalogue"].ToString() + "&Catalogue_Name=" + dtInfo.Rows[0]["System_Description"].ToString() + "&DepartmentName=" + dtInfo.Rows[0]["Dept_Name"].ToString() + "&Contract_ID=" + Request.QueryString["Contract_ID"] + " ','popup',800,1500,40,40,true,true,true,false,'" + btnSearch.ClientID + "'); return false;");
        }
    }
예제 #6
0
    public void SendMailToSupplier(int Quotation_ID, int RFQType, Page currentpg)
    {
        thispage = currentpg;
        string ServerIPAdd = ConfigurationManager.AppSettings["WebQuotSite"].ToString();

        DataSet dsSendMailInfo = BLL_PURC_CTP.Get_Ctp_Supplier_Mail(Quotation_ID);

        switch (RFQType)
        {
        // Excel Based RFQ
        case 1:
            string strPath  = Server.MapPath(".") + "\\SendRFQ\\";
            string FilePath = Server.MapPath("~") + "\\Purchase\\ExcelFile\\";
            FileName = dsSendMailInfo.Tables[0].Rows[0]["QTN_Contract_Code"].ToString() + "_" + dsSendMailInfo.Tables[0].Rows[0]["First_Name"].ToString().Replace(" ", "_").Replace(".", "_") + DateTime.Now.ToString("yyMMdd") + "_" + dsSendMailInfo.Tables[0].Rows[0]["PORT_NAME"].ToString() + ".xls";
            DataSet dsRFQ = BLL_PURC_CTP.Get_Ctp_RFQ_Items(Quotation_ID);

            WriteExcell(dsRFQ, FileName, strPath, FilePath);

            SendEmailToSupplier(dsSendMailInfo, dsSendMailInfo.Tables[0].Rows[0]["supplier_code"].ToString(), ServerIPAdd, FileName, true, RFQType.ToString(), true);
            break;

        // Web Based RFQ
        case 2:


            SendEmailToSupplier(dsSendMailInfo, dsSendMailInfo.Tables[0].Rows[0]["supplier_code"].ToString(), ServerIPAdd, "", true, RFQType.ToString(), true);
            break;
        }
    }
    protected void btnRecallContract_Click(object s, EventArgs e)
    {
        int sts = BLL_PURC_CTP.UPD_CTP_Recall_Approved_Contract(Convert.ToInt32(Request.QueryString["Quotation_ID"]), Convert.ToInt32(Session["userid"]), "-");

        if (sts > 0)
        {
            String msg = String.Format("alert(' Recalled successfully.');window.opener.location.reload();window.open('','_self','');window.close();");
            ScriptManager.RegisterStartupScript(Page, Page.GetType(), "msgclosesucesc", msg, true);
        }
    }
    protected void btnDeleteItem_Click(object s, CommandEventArgs e)
    {
        int sts = BLL_PURC_CTP.Update_Ctp_Remove_QtnItem(Convert.ToInt32(e.CommandArgument), Convert.ToInt32(Request.QueryString["quotation_id"]), Convert.ToInt32(Session["userid"].ToString()));

        if (sts > 0)
        {
            BindDataItems();
            BindFieldsAfterSave();
        }
    }
예제 #9
0
    protected void imgDeleteCTP_Click(object s, EventArgs e)
    {
        string[] prm = (s as ImageButton).CommandArgument.Split(',');
        int      sts = BLL_PURC_CTP.UPD_Ctp_Delete_Contract(UDFLib.ConvertToInteger(prm[0]), UDFLib.ConvertToInteger(prm[1]), Convert.ToInt32(Session["userid"]));

        if (sts > 0)
        {
            BindDataItems();
        }
    }
예제 #10
0
    protected void btnSaveSendToSippliers_Click(object s, EventArgs e)
    {
        try
        {
            DataTable dtGridItems = new DataTable();
            dtGridItems.Columns.Add("Supplier_code", typeof(string));
            dtGridItems.Columns.Add("Port_id", typeof(int));
            dtGridItems.Columns.Add("remark", typeof(string));
            dtGridItems.Columns.Add("RFQType");
            DataRow dr;

            foreach (GridViewRow gr in gvRFQList.Rows)
            {
                string Supp = ((UserControl_uc_SupplierList)gr.FindControl("uc_SupplierListRFQ")).SelectedValue;
                string port = ((UserControl_ctlPortList)gr.FindControl("ctlPortListRFQ")).SelectedValue;

                if (Supp != "0" && port != "0")
                {
                    dr = dtGridItems.NewRow();

                    dr["Supplier_Code"] = Supp;
                    dr["port_id"]       = int.Parse(port);
                    dr["remark"]        = ((TextBox)gr.FindControl("txtRemark")).Text;
                    dr["RFQType"]       = Int32.Parse(((RadioButtonList)gr.FindControl("rbtnRfqType")).SelectedValue);
                    dtGridItems.Rows.Add(dr);
                }
            }

            DataTable dtQtnIdret = BLL_PURC_CTP.Ins_Ctp_SendRFQ(Contract_ID, dtGridItems, Convert.ToInt32(Session["USERID"]));

            if (dtQtnIdret.Rows.Count > 0)
            {
                btnSaveSendToSippliers.Enabled = false;

                BLL_PURC_Purchase objPurc = new BLL_PURC_Purchase();
                CTP_RFQ_Mail      objmail = new CTP_RFQ_Mail();
                //if exists, Insert the Web Quotation supplier code in the PMS_Lib_Quotation_User and lib user
                foreach (DataRow drsupp in dtGridItems.Rows)
                {
                    objPurc.GetSupplierUserDetails(drsupp["Supplier_Code"].ToString(), "S");
                }
                foreach (DataRow drqtn in dtQtnIdret.Rows)
                {
                    objmail.SendMailToSupplier(Convert.ToInt32(drqtn["QUOTATION_ID"].ToString()), Convert.ToInt32(drqtn["RFQType"].ToString()), this.Page);
                }

                String msgretv = String.Format("window.open('','_self','');window.close()");
                ScriptManager.RegisterStartupScript(Page, Page.GetType(), "msgMail", msgretv, true);
            }
        }
        catch (Exception ex)
        {
            lblErrormsg.Text = ex.Message;
        }
    }
예제 #11
0
    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);
        }
    }
예제 #12
0
    protected void btnReworkToSupplier_Click(object sender, EventArgs e)
    {
        int sts = BLL_PURC_CTP.Update_Ctp_ReworkToSupplier(Convert.ToInt32(Session["USERID"].ToString()), Convert.ToInt32(Request.QueryString["Quotation_ID"]));

        if (sts > 0)
        {
            //BindFieldsAfterSave();
            string  ServerIPAdd    = ConfigurationManager.AppSettings["WebQuotSite"].ToString();
            DataSet dsSendMailInfo = BLL_PURC_CTP.Get_Ctp_Supplier_Mail(Convert.ToInt32(Request.QueryString["Quotation_ID"]));

            CTP_RFQ_Mail objmail = new CTP_RFQ_Mail(this);
            objmail.SendEmailToSupplier(dsSendMailInfo, dsSendMailInfo.Tables[0].Rows[0]["supplier_code"].ToString(), ServerIPAdd, "", true, "3", true);
            String msg = String.Format("window.open('','_self','');window.close();");
            ScriptManager.RegisterStartupScript(Page, Page.GetType(), "msg", msg, true);
        }
    }
예제 #13
0
    protected void btndivSave_Click(object sender, EventArgs e)
    {
        try
        {
            int user_type = Convert.ToInt32(ViewState["USER_TYPE"].ToString());

            BLL_PURC_CTP.Update_Ctp_QtnItem_Remark(user_type, txtRemarks.Text, Convert.ToInt32(Session["USERID"].ToString()), Convert.ToInt32(ViewState["QTN_ITEM_ID"].ToString()));

            GridViewRow gr     = (GridViewRow)gvContractDetails.Rows[Convert.ToInt32(ViewState["itemCommentRow"].ToString())];
            ImageButton imgbtn = new ImageButton();
            if (user_type == 1)
            {
                imgbtn = (ImageButton)gr.FindControl("imgSupplierRemark");
            }
            else if (user_type == 2)
            {
                imgbtn = (ImageButton)gr.FindControl("imgPurchaserRemark");
            }

            if (txtRemarks.Text.Trim() == "")
            {
                imgbtn.ImageUrl = "~/Images/remark_new.gif";
            }
            else
            {
                imgbtn.ImageUrl = "~/Images/remark.gif";
            }


            imgbtn.Attributes.Add("Title", "cssbody=[dvbdy1] cssheader=[dvhdr1] header=[ ] body=[" + txtRemarks.Text + "]");
            imgbtn.AlternateText = txtRemarks.Text;

            DivRemarks.Visible = false;

            txtRemarks.Text          = "";
            ViewState["USER_TYPE"]   = "0";
            ViewState["QTN_ITEM_ID"] = "-1";
            updDivRemarks.Update();
        }
        catch (Exception ex)
        {
        }
    }
예제 #14
0
    public void BindData_Selected()
    {
        int IsFetchCount = ucCustomPagerItem_Selected.isCountRecord;

        gvItem_Selected.DataSource = BLL_PURC_CTP.Get_Ctp_Items(Catalogue_code, UDFLib.ConvertStringToNull(SubCatalogue), UDFLib.ConvertStringToNull(txtItemSearch.Text), (DataTable)ViewState["vsdtSelected_Items"], (DataTable)ViewState["vsdtSelected_SubCatalogue"], (DataTable)ViewState["vsdtSelected_SubCatalogue_items"], 1,
                                                                UDFLib.ConvertIntegerToNull(Quotation_ID), ucCustomPagerItem_Selected.CurrentPageIndex, ucCustomPagerItem_Selected.PageSize, ref IsFetchCount, Contract_ID);
        gvItem_Selected.DataBind();
        if (ucCustomPagerItem_Selected.isCountRecord == 1)
        {
            ucCustomPagerItem_Selected.CountTotalRec = IsFetchCount.ToString();
            ucCustomPagerItem_Selected.BuildPager();
        }

        btnDeSelectAll.Enabled = (IsFetchCount < 1) ? false : true;

        btnDeSElctAll_SubCatalogue.Enabled = (((DataTable)ViewState["vsdtSelected_SubCatalogue"]).Rows.Count > 0 && IsFetchCount > 0) ? true : false;

        Set_SelectedCatalogue();
    }
    protected void btnAddToNewContract_Click(object sender, EventArgs e)
    {
        try
        {
            SaveItemsSelection();
            if (((DataTable)ViewState["vsdtSelected_Items"]).Rows.Count > 0)
            {
                DataTable dtSelected = (DataTable)ViewState["vsdtSelected_Items"];

                DataTable dtSelected_SubCatalogue = new DataTable();
                dtSelected_SubCatalogue.Columns.Add("id");


                DataTable vsdtSelected_SubCatalogue_items = new DataTable();
                vsdtSelected_SubCatalogue_items.Columns.Add("id");


                int Contract_ID = BLL_PURC_CTP.Insert_Ctp_CreateNewContract(ddlCatalogue.SelectedValue, Convert.ToInt32(cmbDept.SelectedValue), dtSelected, dtSelected_SubCatalogue, vsdtSelected_SubCatalogue_items, Convert.ToInt32(Session["userid"].ToString()));
                if (Contract_ID > 0)
                {
                    btnAddItemToExistingContract.Enabled = false;
                    btnAddToNewContract.Enabled          = false;
                    uc_Purc_Ctp_Send_RFQSupp.Contract_ID = Contract_ID;
                    mlvCTP.ActiveViewIndex = 1;
                }
                else
                {
                    String msg1 = String.Format("alert('failed to create contract !')");
                    ScriptManager.RegisterStartupScript(Page, Page.GetType(), "msg12865", msg1, true);
                }
            }
            else
            {
                lblmsg.Text = "Please select Item !";
            }
        }
        catch (Exception ex)
        {
            lblmsg.Text = ex.Message;
        }
    }
예제 #16
0
    protected void btnExport_Click(object s, EventArgs e)
    {
        int       is_Fetch_Count = 0;
        DataTable dtexportdata   = BLL_PURC_CTP.Get_Ctp_Contract_Details(Convert.ToInt32(Request.QueryString["Quotation_ID"]),
                                                                         UDFLib.ConvertToInteger(rbtnApprStatus.SelectedValue),
                                                                         UDFLib.ConvertStringToNull(txtItemsDesc.Text),
                                                                         UDFLib.ConvertStringToNull(ddlSubCatalogue.SelectedValue),
                                                                         null,
                                                                         null,
                                                                         ref is_Fetch_Count
                                                                         );

        string[] HeaderCaptions  = new string[] { "Sub Catalogue", "Part No.", "Short Desc.", "Long Desc.", "Unit", "Offer Unit", "Unit Price", "Discount", "Final Unit Price" };
        string[] DataColumnsName = new string[] { "Subsystem_Description", "Part_Number", "Short_Description", "Long_Description", "Unit_and_Packings", "unit", "Rate", "Discount", "net_price" };
        string   FileHeaderName  = @"<table  border='1' cellpadding='3' style='border-collapse:collapse;background-color:#F2F2F2;margin-left:10px;' >
                               
                                <tr><td  style='font-weight:bold;text-align:right'>Dept Name :</td><td >" + lblDepartment.Text + " </td><td style='font-weight:bold;text-align:right' >Catalogue :</td> <td>" + lblCatalogue.Text + " </td><td style='font-weight:bold;text-align:right'>Contract Code :</td> <td>" + lblSeachangeRef.Text + " </td>  </tr>" +
                                   "<tr> <td style='font-weight:bold;text-align:right'>Supplie Name :</td><td>" + lblSupplierName.Text + " </td> <td style='font-weight:bold;text-align:right'>Port :</td><td>" + lblPort.Text + " </td><td style='font-weight:bold;text-align:right'>Supplier Ref No.: </td><td> " + lblSupplierRef.Text + " </td> </tr></table>";
        string FileName = lblSeachangeRef.Text;

        GridViewExportUtil.ShowExcel(dtexportdata, HeaderCaptions, DataColumnsName, FileName, FileHeaderName);
    }
예제 #17
0
    protected void btnCreateContract_Click(object sender, EventArgs e)
    {
        if (lstSelectedItems.Items.Count > 0)
        {
            DataTable dtDeptCatalogue = new DataTable();
            dtDeptCatalogue.Columns.Add("ID");
            dtDeptCatalogue.Columns.Add("Value");
            foreach (ListItem li in lstSelectedItems.Items)
            {
                DataRow dritem = dtDeptCatalogue.NewRow();
                dritem["ID"]    = li.Value.Split('~')[0];
                dritem["Value"] = li.Value.Split('~')[1];

                dtDeptCatalogue.Rows.Add(dritem);
            }

            int res = BLL_PURC_CTP.INS_CTP_Copy_Contract(Convert.ToInt32(Request.QueryString["Quotation_ID"]), Convert.ToInt32(Session["userid"]), txtCopyRemark.Text, dtDeptCatalogue);
            if (res == 1)
            {
                String msg = String.Format("alert(' Contract Created successfully.');window.opener.location.reload();window.open('','_self','');window.close();");
                ScriptManager.RegisterStartupScript(Page, Page.GetType(), "msgclosesucesc", msg, true);
            }
            else if (res == 2)
            {
                String msg = String.Format("alert('Contract already exists !');window.open('','_self','');");
                ScriptManager.RegisterStartupScript(Page, Page.GetType(), "msgclosesucesc", msg, true);
            }
            else if (res == 3)
            {
                String msg = String.Format("alert('Matching item not found !');window.open('','_self','');");
                ScriptManager.RegisterStartupScript(Page, Page.GetType(), "msgclosesucesc", msg, true);
            }
            else
            {
                String msg = String.Format("alert('Error while saving !');window.open('','_self','');");
                ScriptManager.RegisterStartupScript(Page, Page.GetType(), "msgclosesucesc", msg, true);
            }
        }
    }
예제 #18
0
    private void BindContractInfo()
    {
        DataTable dtInfo = BLL_PURC_CTP.Get_Ctp_Contract_Info(Convert.ToInt32(Request.QueryString["Quotation_ID"]), Convert.ToInt32(Request.QueryString["Contract_ID"]));

        if (dtInfo.Rows.Count > 0 && Convert.ToInt32(Request.QueryString["Quotation_ID"]) > 0)
        {
            lblApprovedBy.Text = dtInfo.Rows[0]["ApprovedBy"].ToString();

            lblCatalogue.Text = dtInfo.Rows[0]["System_Description"].ToString();

            lblDepartment.Text  = dtInfo.Rows[0]["Dept_Name"].ToString();
            lblEffectiveDT.Text = dtInfo.Rows[0]["Effective_Date"].ToString();
            lblPort.Text        = dtInfo.Rows[0]["PORT_NAME"].ToString();
            //lblRejectedDT.Text = dtInfo.Rows[0]["ApprovedBy"].ToString();
            lblSeachangeRef.Text = dtInfo.Rows[0]["QTN_Contract_Code"].ToString();


            lblSupplierName.Text = dtInfo.Rows[0]["Full_NAME"].ToString();
            lblSupplierRef.Text  = dtInfo.Rows[0]["Supplier_Ref_Number"].ToString();
            imgApprovedByRmk.Attributes.Add("Title", "cssbody=[dvbdy1] cssheader=[dvhdr1] header=[ ] body=[" + dtInfo.Rows[0]["approver_remark"].ToString() + "]");
        }
    }
예제 #19
0
    private void BindFieldsAfterSave()
    {
        DataTable dtInfo = BLL_PURC_CTP.Get_Ctp_Contract_Info(Convert.ToInt32(Request.QueryString["Quotation_ID"]));

        if (dtInfo.Rows.Count > 0)
        {
            ListItem liCurrency = DDLCurrency.Items.FindByText(dtInfo.Rows[0]["currency"].ToString());
            if (liCurrency != null)
            {
                DDLCurrency.ClearSelection();
                liCurrency.Selected = true;
            }
            txtBargeCharge.Text   = dtInfo.Rows[0]["Barge_Charge"].ToString();
            txtDiscount.Text      = dtInfo.Rows[0]["Discount"].ToString();
            txtFrieghtCharge.Text = dtInfo.Rows[0]["Freight_Charge"].ToString();
            txtOtherCharge.Text   = dtInfo.Rows[0]["Other_Charge"].ToString();
            txtPkgCharge.Text     = dtInfo.Rows[0]["Pkg_Hld_Charge"].ToString();
            txtTruckCharge.Text   = dtInfo.Rows[0]["Truck_Charge"].ToString();
            txtVat.Text           = dtInfo.Rows[0]["Vat"].ToString();


            lblApprovedItem_count.Text = "Item Count :-&nbsp;&nbsp; Approved :&nbsp;" + dtInfo.Rows[0]["APPROVED_ITEM_COUNT"].ToString() + ",&nbsp;&nbsp;&nbsp;Un Approved :&nbsp;" + dtInfo.Rows[0]["NOT_APPROVED_ITEM_COUNT"].ToString();

            if (dtInfo.Rows[0]["Quotation_Status"].ToString() == "FZ" || dtInfo.Rows[0]["Quotation_Status"].ToString() == "AP")
            {
                btnSaveAsDraft.Enabled          = false;
                btnSubmittoseach.Enabled        = false;
                hdf_Quotation_Save_Status.Value = "1";
                hlnkAddItem.Visible             = false;
            }
            else
            {
                btnSaveAsDraft.Enabled          = true;
                btnSubmittoseach.Enabled        = true;
                hdf_Quotation_Save_Status.Value = "0";
                hlnkAddItem.Visible             = true;
            }
        }
    }
예제 #20
0
    protected void BindDataItems()
    {
        int is_Fetch_Count = ucCustomPagerctp.isCountRecord;

        gvContractList.DataSource = BLL_PURC_CTP.Get_Ctp_Contract_List(UDFLib.ConvertStringToNull(uc_SupplierListCTP.SelectedValue),
                                                                       UDFLib.ConvertIntegerToNull(uc_Purc_DepartmentListctp.SelectedValue),
                                                                       UDFLib.ConvertDateToNull(txtEffdtFrom.Text),
                                                                       UDFLib.ConvertDateToNull(txtEffdtTo.Text),
                                                                       UDFLib.ConvertStringToNull(chkQtnStatus.SelectedValue),
                                                                       UDFLib.ConvertIntegerToNull(chkContractStatus.SelectedValue),
                                                                       UDFLib.ConvertIntegerToNull(ctlPortListctp.SelectedValue),
                                                                       UDFLib.ConvertStringToNull(txtItemSearch.Text),
                                                                       ucCustomPagerctp.CurrentPageIndex,
                                                                       ucCustomPagerctp.PageSize,
                                                                       ref is_Fetch_Count);
        gvContractList.DataBind();

        if (ucCustomPagerctp.isCountRecord == 1)
        {
            ucCustomPagerctp.CountTotalRec = is_Fetch_Count.ToString();
            ucCustomPagerctp.BuildPager();
        }
    }
예제 #21
0
    protected void btnExport_Click(object sender, EventArgs e)
    {
        int isfetch = 0;

        DataTable dtCtpList = BLL_PURC_CTP.Get_Ctp_Contract_List(UDFLib.ConvertStringToNull(uc_SupplierListCTP.SelectedValue),
                                                                 UDFLib.ConvertIntegerToNull(uc_Purc_DepartmentListctp.SelectedValue),
                                                                 UDFLib.ConvertDateToNull(txtEffdtFrom.Text),
                                                                 UDFLib.ConvertDateToNull(txtEffdtTo.Text),
                                                                 UDFLib.ConvertStringToNull(chkQtnStatus.SelectedValue),
                                                                 UDFLib.ConvertIntegerToNull(chkContractStatus.SelectedValue),
                                                                 UDFLib.ConvertIntegerToNull(ctlPortListctp.SelectedValue),
                                                                 UDFLib.ConvertStringToNull(txtItemSearch.Text),
                                                                 null,
                                                                 null,
                                                                 ref isfetch);

        string[] HeaderCaptions  = new string[] { "Contract Code", "Effective Date", "Supplier Name", "Dept Name", "Catalogue Name", "Approved Item", "Not approved items", "Approved By", "Approved Date", "Status" };
        string[] DataColumnsName = new string[] { "QTN_Contract_Code", "Effective_Date", "Full_NAME", "Dept_Name", "System_Description", "APPROVED_ITEM_COUNT", "NOT_APPROVED_ITEM_COUNT", "First_Name", "Approved_Date", "QTN_STS" };
        string   FileHeaderName  = "Contract List";
        string   FileName        = "Contract_List";

        GridViewExportUtil.ShowExcel(dtCtpList, HeaderCaptions, DataColumnsName, FileName, FileHeaderName);
    }
    private void BindSuppliers()
    {
        rgdSupplierInfo.DataSource = BLL_PURC_CTP.Get_Ctp_Qtn_Eval_Supplier((DataTable)ViewState["dtqtns"]);
        rgdSupplierInfo.DataBind();
        if (!IsPostBack)
        {
            ViewState["isAllApproved"] = true;
            foreach (GridViewRow gr in rgdSupplierInfo.Rows)
            {
                if (((HiddenField)gr.FindControl("hdfQuotation_Status")).Value != "AP")
                {
                    ViewState["isAllApproved"] = false;
                }
                dicQtnSts.Add(Convert.ToInt32(rgdSupplierInfo.DataKeys[gr.RowIndex].Values["Quotation_ID"].ToString()), ((HiddenField)gr.FindControl("hdfQuotation_Status")).Value);
            }

            ViewState["dicQtnSts"] = dicQtnSts;
        }
        if (bool.Parse(ViewState["isAllApproved"].ToString()))
        {
            btnFinalizeEval.Visible = false;
            btnSaveEvaln.Visible    = false;
        }
    }
예제 #23
0
    protected void BindDataItems()
    {
        if (IsPostBack && hdf_Quotation_Save_Status.Value == "0")
        {
            SaveItemPrice();
        }

        int is_Fetch_Count = ucCustomPagerctp.isCountRecord;

        gvContractDetails.DataSource = BLL_PURC_CTP.Get_Ctp_Contract_Details(Convert.ToInt32(Request.QueryString["Quotation_ID"]),
                                                                             UDFLib.ConvertToInteger(rbtnApprStatus.SelectedValue),
                                                                             UDFLib.ConvertStringToNull(txtItemsDesc.Text),
                                                                             UDFLib.ConvertStringToNull(ddlSubCatalogue.SelectedValue),
                                                                             ucCustomPagerctp.CurrentPageIndex,
                                                                             ucCustomPagerctp.PageSize,
                                                                             ref is_Fetch_Count
                                                                             );
        gvContractDetails.DataBind();
        if (ucCustomPagerctp.isCountRecord == 1)
        {
            ucCustomPagerctp.CountTotalRec = is_Fetch_Count.ToString();
            ucCustomPagerctp.BuildPager();
        }
    }
 protected void BindContractList_Grid()
 {
     gvContractList_qtn.DataSource = BLL_PURC_CTP.Get_Ctp_Contract_List_ByCatalogue(ddlCatalogue.SelectedValue, UDFLib.ConvertIntegerToNull(ctlPortListCtp.SelectedValue), UDFLib.ConvertStringToNull(uc_SupplierListCtp.SelectedValue), UDFLib.ConvertStringToNull(txtContractCode.Text));
     gvContractList_qtn.DataBind();
 }
    protected void BindItems()
    {
        if (!isCallFromPageLoad)
        {
            SaveItems();
        }

        #region ===================== Merge header columns ============================
        DataTable dtqtn = (DataTable)ViewState["dtqtns"];

        if (objItemColumn.MergedColumns.Count == 0)
        {
            int    columnindex  = lastFixedColumnID + 1;
            int    groupid      = 1;
            string GroupCss     = "";
            string suppliername = "";
            string portname     = "";
            foreach (GridViewRow gr in rgdSupplierInfo.Rows)
            {
                DataRow drqtnid = dtqtn.Rows.Find(rgdSupplierInfo.DataKeys[gr.RowIndex].Values["Quotation_ID"].ToString());
                //get show only quoted item status for filter

                drqtnid["onlyQuoted"]    = ((CheckBox)gr.FindControl("chkshowOnlyQuoted")).Checked == true ? "1" : "0";
                drqtnid["ApprvalStatus"] = ((DropDownList)gr.FindControl("ddlApproval")).SelectedValue == "" ? null : ((DropDownList)gr.FindControl("ddlApproval")).SelectedValue;

                dicchkOnlyQuoted.Add(gr.RowIndex, ((CheckBox)gr.FindControl("chkshowOnlyQuoted")).Checked);

                dicddlApproval.Add(gr.RowIndex, ((DropDownList)gr.FindControl("ddlApproval")).SelectedValue);

                if (groupid % 2 == 1)
                {
                    GroupCss = "Ctp-QtnEval-HeaderStyle-css";
                }
                else
                {
                    GroupCss = "Ctp-QtnEval-AltHeaderStyle-css";
                }

                suppliername = ((Label)gr.FindControl("lblSupplierName")).Text;
                suppliername = suppliername.Length > 20 ? suppliername.Substring(0, 19) : suppliername;
                portname     = ((Label)gr.FindControl("lblPortName")).Text;
                portname     = portname.Length > 20 ? portname.Substring(0, 19) : portname;

                objItemColumn.AddMergedColumns(new int[] { columnindex, columnindex + 1, columnindex + 2, columnindex + 3, columnindex + 4, columnindex + 5, columnindex + 6 }, suppliername + "&nbsp ,&nbsp " + portname, GroupCss);


                columnindex += SupplierColumnGroup;
                groupid++;
            }

            dtqtn.AcceptChanges();
        }

        #endregion


        int is_fetch_count = ucCustomPageritems.isCountRecord;

        rgdQuatationInfo.DataSource = BLL_PURC_CTP.Get_Ctp_Qtn_Eval_Item(dtqtn,
                                                                         UDFLib.ConvertStringToNull(txtitemsearch.Text),
                                                                         UDFLib.ConvertStringToNull(ddlSubCatalogue.SelectedValue),
                                                                         UDFLib.ConvertIntegerToNull(""),
                                                                         ucCustomPageritems.CurrentPageIndex,
                                                                         ucCustomPageritems.PageSize,
                                                                         ref is_fetch_count,
                                                                         UDFLib.ConvertIntegerToNull(ViewState["SortDirection"]),
                                                                         UDFLib.ConvertStringToNull(ViewState["SortColumn"]));

        rgdQuatationInfo.DataBind();

        if (ucCustomPageritems.isCountRecord == 1)
        {
            ucCustomPageritems.CountTotalRec = is_fetch_count.ToString();
            ucCustomPageritems.BuildPager();
        }

        isCallFromPageLoad = false;
    }
예제 #26
0
    protected void btnUpload_Click(object sender, EventArgs e)
    {
        try
        {
            if (FileUpload1.HasFile)
            {
                //FileUpload1.
                string strLocalPath = FileUpload1.PostedFile.FileName;

                string FileName = Path.GetFileName(strLocalPath);

                if (Path.GetExtension(FileName).ToUpper() == ".XLS")
                {
                    try
                    {
                        FileUpload1.PostedFile.SaveAs(Server.MapPath("TempUpload\\" + FileName));


                        string strPath = Server.MapPath("TempUpload\\" + FileName).ToString();


                        //string[] arrfn = FileName.Split('\\');
                        // string strPath = Server.MapPath("SendRFQ") + "\\" + arrfn[arrfn.Length - 1];

                        ExlApp     = new Microsoft.Office.Interop.Excel.Application();
                        ExlWrkBook = ExlApp.Workbooks.Open(strPath,
                                                           0,
                                                           true,
                                                           5,
                                                           "", "",
                                                           true,
                                                           Microsoft.Office.Interop.Excel.XlPlatform.xlWindows,
                                                           "\t",
                                                           false,
                                                           false,
                                                           0,
                                                           true,
                                                           1,
                                                           0);
                        ExlWrkSheet = (Microsoft.Office.Interop.Excel.Worksheet)ExlWrkBook.ActiveSheet;


                        int Quotation_ID   = UDFLib.ConvertToInteger(((ExcelNS.Range)ExlWrkSheet.Cells[6, 15]).Value2);
                        int QuotationIDrow = Convert.ToInt32(hdf_QuotationID.Value);
                        if (Quotation_ID == QuotationIDrow)
                        {
                            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.ConvertIntegerToNull(((ExcelNS.Range)ExlWrkSheet.Cells[5, 3]).Value2);
                            drCharges["Truck_Charge"]   = UDFLib.ConvertDecimalToNull(((ExcelNS.Range)ExlWrkSheet.Cells[9, 3]).Value2);
                            drCharges["Barge_Charge"]   = UDFLib.ConvertDecimalToNull(((ExcelNS.Range)ExlWrkSheet.Cells[9, 9]).Value2);
                            drCharges["Freight_Charge"] = UDFLib.ConvertDecimalToNull(((ExcelNS.Range)ExlWrkSheet.Cells[5, 9]).Value2);
                            drCharges["Pkg_Hld_Charge"] = UDFLib.ConvertDecimalToNull(((ExcelNS.Range)ExlWrkSheet.Cells[7, 9]).Value2);
                            drCharges["Other_Charge"]   = UDFLib.ConvertDecimalToNull(((ExcelNS.Range)ExlWrkSheet.Cells[8, 9]).Value2);
                            drCharges["Vat"]            = UDFLib.ConvertDecimalToNull(((ExcelNS.Range)ExlWrkSheet.Cells[9, 7]).Value2);
                            drCharges["Discount"]       = UDFLib.ConvertDecimalToNull(((ExcelNS.Range)ExlWrkSheet.Cells[8, 3]).Value2);

                            dtCharges.Rows.Add(drCharges);

                            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 drNew;
                            int     i = 15;
                            while (((ExcelNS.Range)ExlWrkSheet.Cells[i, 1]).Value2 != null)
                            {
                                double value = 0;
                                if (double.TryParse(((ExcelNS.Range)ExlWrkSheet.Cells[i, 1]).Value2.ToString(), out value))
                                {
                                    drNew         = dtItemPrice.NewRow();
                                    drNew["pkid"] = ((ExcelNS.Range)ExlWrkSheet.Cells[i, 4]).Value2.ToString();


                                    if (((ExcelNS.Range)ExlWrkSheet.Cells[i, 6]).Value2 != null)
                                    {
                                        drNew["unit"] = ((ExcelNS.Range)ExlWrkSheet.Cells[i, 6]).Value2.ToString();
                                    }
                                    else
                                    {
                                        drNew["unit"] = "";
                                    }

                                    if (((ExcelNS.Range)ExlWrkSheet.Cells[i, 8]).Value2 != null)
                                    {
                                        drNew["rate"] = ((ExcelNS.Range)ExlWrkSheet.Cells[i, 8]).Value2.ToString();
                                    }
                                    else
                                    {
                                        drNew["rate"] = "0";
                                    }
                                    if (((ExcelNS.Range)ExlWrkSheet.Cells[i, 9]).Value2 != null)
                                    {
                                        drNew["discount"] = ((ExcelNS.Range)ExlWrkSheet.Cells[i, 9]).Value2.ToString();
                                    }
                                    else
                                    {
                                        drNew["discount"] = "0";
                                    }

                                    if (((ExcelNS.Range)ExlWrkSheet.Cells[i, 12]).Value2 != null)
                                    {
                                        drNew["supp_remark"] = ((ExcelNS.Range)ExlWrkSheet.Cells[i, 12]).Value2.ToString();
                                    }
                                    else
                                    {
                                        drNew["supp_remark"] = "";
                                    }

                                    dtItemPrice.Rows.Add(drNew);
                                }
                                i = i + 3;
                            }
                            dtItemPrice.AcceptChanges();

                            if (dtItemPrice.Rows.Count > 0)
                            {
                                if (dtItemPrice.Select("rate > 0").Length > 0)
                                {
                                    BLL_PURC_CTP.Upd_Ctp_Items_Price(Quotation_ID, dtItemPrice, Convert.ToInt32(Session["userid"].ToString()), 1, dtCharges);
                                    BindDataItems();
                                }
                            }
                        }
                        else
                        {
                        }
                    }
                    catch { }
                    finally
                    {
                        ExlWrkBook.Close(null, null, null);
                        //ExlApp.Workbooks.Close();
                        ExlApp.Quit();
                        Marshal.ReleaseComObject(ExlApp);
                        Marshal.ReleaseComObject(ExlWrkSheet);
                        Marshal.ReleaseComObject(ExlWrkBook);
                    }
                }
                else
                {
                    String msg = String.Format("alert('The uploaded file do not belong to the selected supplier');");
                    ScriptManager.RegisterStartupScript(Page, Page.GetType(), "msginvalidSupplier", msg, true);
                }
            }
        }
        catch (Exception ex)
        {
            String msg = String.Format("alert('The uploaded file do not belong to the selected supplier');");
            ScriptManager.RegisterStartupScript(Page, Page.GetType(), "msg", msg, true);
        }
    }