public PartialViewResult QuotationViewForDownload(string QuotationId) { ssmtbl_QuotationModel objQuot = new ssmtbl_QuotationModel(); objQuot = objQuotAppData.GetOneQuotationForApproval(QuotationId); return(PartialView(objQuot)); }
public PartialViewResult QuotationViewForApproval(string QuotationId) { ssmtbl_QuotationModel objQuot = new ssmtbl_QuotationModel(); objQuot = objQuotAppData.GetOneQuotationForApproval(QuotationId); // string sqlstr = "uspMultislectTag"; var connection = gConnection.Connection(); connection.Open(); SqlCommand cmd = new SqlCommand(sqlstr, connection); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@Action", "FisibilityOperationInvolvedSequence"); cmd.Parameters.AddWithValue("@QuotationId", QuotationId.Trim()); SqlDataAdapter da = new SqlDataAdapter(cmd); DataTable dt = new DataTable(); da.Fill(dt); connection.Close(); ViewData["fisopvinvseqlist"] = dt; // return(PartialView(objQuot)); }
//[ValidateAntiForgeryToken] //public ActionResult CreateQuotation(ssmtbl_QuotationModel model, FormCollection frmCol) public JsonResult CreateQuotation(ssmtbl_QuotationModel model, int QuotationId) { DataTable dt = new DataTable(); bool newQuot = model.chk_NewQuotation; //bool newQuot = Convert.ToBoolean(frmCol["ChkNewQuotation"].Split(',')[0]); //model.id = Convert.ToInt32(frmCol["QuotationId"].ToString()); //dt.Columns.Add("TermsNConditionID"); //dt.Columns.Add("TermsNConditionContent"); //for (int i = 1; i <= Convert.ToInt32(frmCol["TotalTermsNcondition"]); i++) //{ // string[] selectedVal = frmCol["chkitem" + i].Split(','); // if (selectedVal[0].ToString().ToLower() == "true") // { // dt.Rows.Add(frmCol["chkitemID" + i], frmCol["txtbox" + i]); // //dt.Rows.Add(frmCol["txtbox" + i]); // } //} string Result = ""; string Versioncreate = ""; long id = 0; if (newQuot == true) { //var tuple= objQuotation.InsertQuotataion(model, dt); var tuple = objQuotation.InsertQuotataion(model, QuotationId); id = tuple.Item1; string result = tuple.Item2; } else { //Result = objQuotation.UpdateQuotataion(model, dt); Result = objQuotation.UpdateQuotataion(model, QuotationId); } if (Result == "Quotation Created Successfully!") { TempData["HideClass"] = "alert alert-success"; TempData["Message"] = Result; } else if (Result == "Quotation Updated Successfully!") { TempData["HideClass"] = "alert alert-success"; TempData["Message"] = Result; } else { @ViewBag.HideClass = "alert alert-danger"; @ViewBag.Message = Result; } Versioncreate = objQuotation.CreateQVersion(model, QuotationId); return(Json(id, JsonRequestBehavior.AllowGet)); //return RedirectToAction("AllInquiry", "Inquiry"); }
public List <ssmtbl_QuotationModel> GetAllversion(long InquiryNo) { var connection = gConnection.Connection(); List <ssmtbl_QuotationModel> objList = new List <ssmtbl_QuotationModel>(); try { //sqlstr = "SELECT ssmtbl_Inquiry.Status, ssmtbl_Quotation.VersionNo, ssmtbl_Quotation.Comment, ssmtbl_Quotation.CreatedOn, ssmtbl_Quotation.Createdby, " //+ " ssmtbl_Quotation.ApprovalDate, ssmtbl_Quotation.ApprovedBy, ssmtbl_Quotation.id,ssmtbl_Quotation.InquiryNo" //+ " FROM ssmtbl_Inquiry INNER JOIN" //+ " ssmtbl_Quotation ON ssmtbl_Inquiry.InquiryNo = ssmtbl_Quotation.InquiryNo and ssmtbl_Inquiry.InquiryNo=@InquiryNo"; sqlstr = "SELECT Isnull(FileStatus,'') As Status, ssmtbl_Quotation.VersionNo, ssmtbl_Quotation.Comment, ssmtbl_Quotation.CreatedOn, ssmtbl_Quotation.Createdby, " + " ssmtbl_Quotation.ApprovalDate, ssmtbl_Quotation.ApprovedBy, ssmtbl_Quotation.id,ssmtbl_Quotation.InquiryNo" + " FROM ssmtbl_Quotation where InquiryNo=@InquiryNo"; connection.Open(); SqlCommand cmd = new SqlCommand(sqlstr, connection); cmd.Parameters.AddWithValue("@InquiryNo", InquiryNo); SqlDataReader sdr = cmd.ExecuteReader(); while (sdr.Read()) { ssmtbl_QuotationModel obj = new ssmtbl_QuotationModel(); obj.FileStatus = sdr["Status"].ToString(); obj.VersionNo = sdr["VersionNo"].ToString(); obj.Comment = sdr["Comment"].ToString(); obj.CreatedOn = (string.IsNullOrEmpty(sdr["CreatedOn"].ToString())) ? default(DateTime) : Convert.ToDateTime(sdr["CreatedOn"].ToString()); obj.Createdby = sdr["Createdby"].ToString(); obj.ApprovalDate = (string.IsNullOrEmpty(sdr["ApprovalDate"].ToString())) ? default(DateTime) : Convert.ToDateTime(sdr["ApprovalDate"].ToString()); obj.ApprovedBy = sdr["ApprovedBy"].ToString(); obj.id = Convert.ToInt32(sdr["id"].ToString()); obj.InquiryNo = Convert.ToInt32(sdr["InquiryNo"].ToString()); objList.Add(obj); } connection.Close(); } catch (Exception ex) { ErrorHandlerClass.LogError(ex); connection.Close(); } return(objList); }
public List <ssmtbl_QuotationModel> GetAllQuotationForApproval() { List <ssmtbl_QuotationModel> objQuotList = new List <ssmtbl_QuotationModel>(); try { //string sqlstr = "Select id, Isnull(Q.InquiryNo,0) As InquiryNo, Isnull(QuotationNo,0) As QuotationNo, Isnull(VersionNo,'') As VersionNo, " // + " Isnull(CreatedOn,'') As CreatedOn, Isnull(Q.CreatedBy,'') As CreatedBy, Isnull(Q.customerName,'') As customerName " // + " From dbo.ssmtbl_Quotation Q, ssmtbl_Inquiry I where Q.InquiryNo=I.InquiryNo And ISNULL(Filestatus,'')=''"; string sqlstr = " Select id, Isnull(Q.InquiryNo,0) As InquiryNo, Isnull(QuotationNo,0) As QuotationNo, Isnull(VersionNo,'') As VersionNo, " + " Isnull(CreatedOn,'') As CreatedOn, Isnull(Q.CreatedBy,'') As CreatedBy, Isnull(Q.customerName,'') As customerName, Isnull(new_Version_No,0) As new_Version_No " + " From dbo.ssmtbl_Quotation Q, ssmtbl_Inquiry I where Q.InquiryNo=I.InquiryNo And ISNULL(Filestatus,'')=@Filestatus" + " and ID in (Select MAX(id) From ssmtbl_Quotation group by QuotationNo ) order by Q.CreatedOn desc"; var connection = gConnection.Connection(); connection.Open(); SqlCommand cmd = new SqlCommand(sqlstr, connection); cmd.Parameters.AddWithValue("@Filestatus", InquiryStatus.QuotationPendingForApproval); SqlDataReader sdr = cmd.ExecuteReader(); while (sdr.Read()) { ssmtbl_QuotationModel objtemp = new ssmtbl_QuotationModel(); objtemp.id = Convert.ToInt32(sdr["id"].ToString()); objtemp.InquiryNo = Convert.ToInt32(sdr["InquiryNo"].ToString()); objtemp.QuotationNo = sdr["QuotationNo"].ToString(); objtemp.VersionNo = sdr["VersionNo"].ToString(); objtemp.CreatedOn = Convert.ToDateTime(sdr["CreatedOn"].ToString()); objtemp.Createdby = sdr["CreatedBy"].ToString(); objtemp.CustomerName = sdr["customerName"].ToString(); objtemp.new_Version_No = Convert.ToInt32(sdr["new_Version_No"].ToString()); objQuotList.Add(objtemp); } connection.Close(); } catch (Exception ex) { ErrorHandlerClass.LogError(ex); } return(objQuotList); }
public List <ssmtbl_QuotationModel> GetAllVersionOfOneQuotation(string QuotationNo) { List <ssmtbl_QuotationModel> objQuotList = new List <ssmtbl_QuotationModel>(); try { string sqlstr = " Select id, Isnull(Q.InquiryNo,0) As InquiryNo, Isnull(QuotationNo,0) As QuotationNo, Isnull(VersionNo,'') As VersionNo, " + " Isnull(CreatedOn,'') As CreatedOn, Isnull(Q.CreatedBy,'') As CreatedBy, Isnull(Q.customerName,'') As customerName , " + " Isnull(FileStatus,'') as FileStatus, Isnull(new_Version_No,0) As new_Version_No From dbo.ssmtbl_Quotation Q where Isnull(QuotationNo,0)=@QuotationNo"; var connection = gConnection.Connection(); connection.Open(); SqlCommand cmd = new SqlCommand(sqlstr, connection); cmd.Parameters.AddWithValue("@QuotationNo", QuotationNo); SqlDataReader sdr = cmd.ExecuteReader(); while (sdr.Read()) { ssmtbl_QuotationModel objtemp = new ssmtbl_QuotationModel(); objtemp.id = Convert.ToInt32(sdr["id"].ToString()); objtemp.InquiryNo = Convert.ToInt32(sdr["InquiryNo"].ToString()); objtemp.QuotationNo = sdr["QuotationNo"].ToString(); objtemp.VersionNo = sdr["VersionNo"].ToString(); objtemp.CreatedOn = Convert.ToDateTime(sdr["CreatedOn"].ToString()); objtemp.Createdby = sdr["CreatedBy"].ToString(); objtemp.CustomerName = sdr["customerName"].ToString(); objtemp.FileStatus = sdr["FileStatus"].ToString(); objtemp.new_Version_No = Convert.ToInt32(sdr["new_Version_No"].ToString()); objQuotList.Add(objtemp); } connection.Close(); } catch (Exception ex) { ErrorHandlerClass.LogError(ex); } return(objQuotList); }
// GET: Quotation public ActionResult NewQuotation(string id) { ssmtbl_QuotationModel modelQuotation = new ssmtbl_QuotationModel(); ssmtbl_InquiryModel modelInquiry = new ssmtbl_InquiryModel(); ssmtbl_FeasibilityModel modelFeasibility = new ssmtbl_FeasibilityModel(); ssmtbl_QuotationModel latestQuotation = objQuotation.GetLetestQuotationID(Convert.ToInt32(id)); try { if (id == "" || ModelState.IsValid == false) { return(View(modelQuotation)); } modelInquiry = objInqData.GetOneInquiry(Convert.ToInt32(id)); if (latestQuotation.id == 0 || modelInquiry.Status == "Feasibility Done") { if (modelInquiry != null) { modelQuotation.InquiryNo = modelInquiry.InquiryNo; //modelQuotation.QuotationNo = "Q-" + modelInquiry.InquiryNo; modelQuotation.QuotationNo = "SSM_" + StandardDateTime.GetDateTime().ToString("yy") + StandardDateTime.GetDateTime().ToString("MM") + "_" + modelInquiry.InquiryNo; modelQuotation.PartDescription = modelInquiry.PartName; modelQuotation.PartNo = modelInquiry.PartNo; modelQuotation.CustomerName = modelInquiry.customerName; modelQuotation.FileStatus = modelInquiry.Status; } modelFeasibility = objFesiData.GetOneFeasibility(Convert.ToInt32(id)); if (modelFeasibility != null) { modelQuotation.CutWeight = modelFeasibility.cutweight; modelQuotation.NetWeight = modelFeasibility.netweight; modelQuotation.GrossWeight = modelFeasibility.grossweight; modelQuotation.MachainedWeight = modelFeasibility.materialweights.ToString(); modelQuotation.SectionId = Convert.ToInt64(modelFeasibility.Section); // Sharad modelQuotation.Section = objQuotation.getSectionNane(modelFeasibility.Section); // Sharad ViewData["fistotal"] = modelFeasibility.fisdiatotal; string MaterialID = modelFeasibility.FeasibilityMaterialGrade.ToString(); var getMaterialGrad = objDrop.FeasibilityMaterialGrade().FirstOrDefault(m => m.Value == MaterialID); if (getMaterialGrad != null) { modelQuotation.Material = getMaterialGrad.Text; } if (modelFeasibility.ssmtbl_Feasibility_MultiVendorModel != null) { ViewData["MultiVendors"] = modelFeasibility.ssmtbl_Feasibility_MultiVendorModel; } string HeattreatmentlID = modelFeasibility.FeasibilityHeattreatment.ToString(); var getHeattreatment = objDrop.FeasibilityHeatTreatment().FirstOrDefault(m => m.Value == HeattreatmentlID); if (getHeattreatment != null) { modelQuotation.HeatTreatmentID = getHeattreatment.Value; modelQuotation.HeatTreatmentText = getHeattreatment.Text; } } } else { modelQuotation = latestQuotation; modelQuotation.PerPieceRate = modelInquiry.Qty; modelQuotation.CuttingRate = objQuotation.GetOneCutingCalculation(Convert.ToInt32(modelQuotation.Section)).cuttingrateperpc; // ViewData["QuotaionTermsAndCondition"] = GlobalFunction.GetSelectedQuotaionTermsAndCondition(modelQuotation.id); modelFeasibility = objFesiData.GetOneFeasibility(Convert.ToInt32(latestQuotation.InquiryNo)); if (modelFeasibility.ssmtbl_Feasibility_OperationsInvolvedModel != null) { ViewData["OperationsInvolved"] = modelFeasibility.ssmtbl_Feasibility_OperationsInvolvedModel; ViewData["NatureofWork"] = modelFeasibility.FeasibilityNatureofWork;// Sharad } ViewData["QuotaionTermsAndCondition"] = GlobalFunction.GetLKP_QuotaionTermsAndCondition(modelInquiry.InquiryNo); ViewData["Allversion"] = objQuotation.GetAllversion(modelQuotation.InquiryNo); modelQuotation.Material = objQuotation.GetMaterialGradeByID(modelFeasibility.FeasibilityMaterialGrade); // Sharad modelQuotation.SectionId = Convert.ToInt64(modelFeasibility.Section); // Sharad modelQuotation.Section = objQuotation.getSectionNane(modelFeasibility.Section); // Sharad string HeattreatmentlID = modelFeasibility.FeasibilityHeattreatment.ToString(); var getHeattreatment = objDrop.FeasibilityHeatTreatment().FirstOrDefault(m => m.Value == HeattreatmentlID); if (getHeattreatment != null) { modelQuotation.HeatTreatmentID = getHeattreatment.Value; modelQuotation.HeatTreatmentText = getHeattreatment.Text; } ViewData["fistotal"] = modelFeasibility.fisdiatotal; ViewData["MultiVendors"] = modelFeasibility.ssmtbl_Feasibility_MultiVendorModel; return(View(modelQuotation)); } modelQuotation.PerPieceRate = modelInquiry.Qty; modelFeasibility = objFesiData.GetOneFeasibility(Convert.ToInt32(id)); if (modelFeasibility.ssmtbl_Feasibility_OperationsInvolvedModel != null) { ViewData["OperationsInvolved"] = modelFeasibility.ssmtbl_Feasibility_OperationsInvolvedModel; ViewData["NatureofWork"] = modelFeasibility.FeasibilityNatureofWork;// Sharad } ViewData["QuotaionTermsAndCondition"] = GlobalFunction.GetLKP_QuotaionTermsAndCondition(modelInquiry.InquiryNo); ViewData["NatureofWork"] = modelFeasibility.FeasibilityNatureofWork;// Sharad ViewData["Allversion"] = objQuotation.GetAllversion(modelQuotation.InquiryNo); ViewData["MultiVendors"] = modelFeasibility.ssmtbl_Feasibility_MultiVendorModel; } catch (Exception ex) { ErrorHandlerClass.LogError(ex); } return(View(modelQuotation)); }
// public ActionResult QuotationPDF(string QuotationId) public FileResult QuotationPDF(string QuotationId) { string filenm = ""; var fpath = ""; string contentType = ""; try { //string QuotationId = frm["id"].ToString(); fpath = HttpContext.Server.MapPath("~/PDFFiles/Quotation/"); ssmtbl_QuotationModel objQuot = new ssmtbl_QuotationModel(); objQuot = objQuotAppData.GetOneQuotationForApproval(QuotationId); ssmtbl_FeasibilityModel modelFeasibility = new ssmtbl_FeasibilityModel(); modelFeasibility = objFesiData.GetOneFeasibility(Convert.ToInt32(objQuot.InquiryNo)); string str = objQuot.QuotationNo.Substring(0, 8); filenm = str + "_" + objQuot.CustomerName + "_" + objQuot.InquiryNo + "_" + objQuot.new_Version_No + ".pdf"; Document doc = new Document(PageSize.A4, 25, 25, 10, 20); PdfWriter writer = PdfWriter.GetInstance(doc, new FileStream(fpath + filenm, FileMode.Create)); doc.Open(); iTextSharp.text.html.simpleparser.StyleSheet styles = new iTextSharp.text.html.simpleparser.StyleSheet(); iTextSharp.text.html.simpleparser.HTMLWorker hw = new iTextSharp.text.html.simpleparser.HTMLWorker(doc); iTextSharp.text.Image image1 = iTextSharp.text.Image.GetInstance(HttpContext.Server.MapPath("~/NewCssAndTheme/img/ssmlogo.jpg")); image1.Alignment = iTextSharp.text.Image.ALIGN_CENTER; image1.SetAbsolutePosition(20, 780); image1.ScaleToFit(80f, 80f); doc.Add(image1); string pdfbody = "<div style='font: 10px; border= 1'>"; pdfbody += "<div style='text-align:center'>"; pdfbody += "<font size='3'>SHREE SIDDHESHWARI METAL FORGING PRIVATE LIMITED</font>"; pdfbody += "</div>"; pdfbody += "<div style='text-align:center;>"; pdfbody += "<font size='medium'>J-489/490,M.I.D.C BHOSARI, PUNE-26</font>"; pdfbody += "</div>"; pdfbody += "<div style='text-align:center;>"; pdfbody += "<font size='medium'>Email - [email protected] Tel: 020-27130120</font>"; pdfbody += "</div>"; //doc.Add(Chunk.NEWLINE); //hw.Parse(new StringReader(pdfbody)); pdfbody += "<div style='text-align:center;'>"; pdfbody += "<font size='3' font-weight='bold'>QUOTATION</font>"; pdfbody += "</div>"; //doc.Add(Chunk.NEWLINE); //hw.Parse(new StringReader(pdfbody)); pdfbody += "<div style='text-align:right; font-size: medium'>"; pdfbody += "<h4 style='text-align:right'>Quotation # " + objQuot.QuotationNo; pdfbody += "</h4>"; //pdfbody += "<small> Revision Number:" + objQuot.new_Version_No; pdfbody += "<small> Date: " + objQuot.CreatedOn.Date.ToString("dd-MMM-yyyy"); pdfbody += "</small>"; pdfbody += "</div>"; //doc.Add(Chunk.NEWLINE); //hw.Parse(new StringReader(pdfbody)); pdfbody += "<div style='text-align:Left; font-size: medium'>"; pdfbody += "To, <br/>" + objQuot.CustomerName; pdfbody += "<br/>" + objQuot.address; pdfbody += "</div>"; // pdfbody += "<table border='0' cellpadding='5' cellspacing='0'>"; //pdfbody += "<tbody >"; //pdfbody += "<tr>"; //pdfbody += "<th style='text-align:left'>"; //pdfbody += "Quotation Number:- " + objQuot.QuotationNo; //pdfbody += "</th>"; //pdfbody += "<th style='text-align:left'>"; //pdfbody += "Revision Number:- " + objQuot.new_Version_No; //pdfbody += "</th>"; //pdfbody += "</tr>"; //pdfbody += "<tr>"; //pdfbody += "<th style='text-align:left'>"; //pdfbody += " "; //pdfbody += "</th>"; //pdfbody += "<th style='text-align:left'>"; //pdfbody += "Date:- " + objQuot.CreatedOn.Date.ToString("dd-MMM-yyyy"); //pdfbody += "</th>"; //pdfbody += "</tr>"; //pdfbody += "</tbody>"; //pdfbody += "</table>"; //doc.Add(Chunk.NEWLINE); //hw.Parse(new StringReader(pdfbody)); pdfbody += "<br/> <table border='0' cellpadding='3' cellspacing='0' style='font-size: medium'>"; pdfbody += "<tbody >"; pdfbody += "<tr>"; //pdfbody += "<th width='5%' style='text-align:left; width:5%'>"; //pdfbody += "<b>I</b>"; //pdfbody += "</th>"; pdfbody += "<th>"; pdfbody += "Part Description: " + objQuot.PartDescription; pdfbody += " | Material: " + objQuot.Material + " | Customer Part No:" + objQuot.PartNo; pdfbody += "<br/> Heat Treatment: " + objQuot.HeatTreatmentText + " | Hardness: Min: " + modelFeasibility.hardnessmin; pdfbody += " Max: " + modelFeasibility.hardnessmax + " " + modelFeasibility.hardnessunits; pdfbody += "</th>"; pdfbody += "</tr>"; pdfbody += "</tbody>"; pdfbody += "</table>"; //pdfbody = "<table border='1' cellpadding='3' cellspacing='0'>"; //pdfbody += "<tbody >"; //pdfbody += "<tr>"; //pdfbody += "<th width='5%' style='text-align:left; width:5%'>"; //pdfbody += "<b>I</b>"; //pdfbody += "</th>"; //pdfbody += "<th style='text-align:left'>"; //pdfbody += "Part Description:- " + objQuot.PartDescription + "<br />"; //pdfbody += "Material:- " + objQuot.Material + "<br />"; //pdfbody += "Customer:- " + objQuot.CustomerName + "<br />"; //pdfbody += "</th>"; //pdfbody += "<th style='text-align:left'>"; //pdfbody += "Part No:- " + objQuot.PartNo + "<br />"; //pdfbody += "Heat Treatment:- " + objQuot.HeatTreatmentText + "<br />"; //pdfbody += "Min:- " + modelFeasibility.hardnessmin + " Max:- " + modelFeasibility.hardnessmax+" "+modelFeasibility.hardnessunits+"" ; //pdfbody += "</th>"; //pdfbody += "</tr>"; //pdfbody += "</tbody>"; //pdfbody += "</table>"; pdfbody += "<table border='1' cellpadding='2' cellspacing='0' style='font-size: medium'>"; pdfbody += "<tbody>"; pdfbody += "<tr>"; pdfbody += "<th width='5%' style='text-align:left; width:5%'>"; pdfbody += "<b> I</b>"; pdfbody += "</th>"; pdfbody += "<th style='text-align:left'>"; pdfbody += "Component Weight Details <br />"; //pdfbody += "<br />"; pdfbody += "Gross Weight (kg): " + objQuot.GrossWeight; pdfbody += " Cut Weight (kg): " + objQuot.CutWeight; pdfbody += " Forged Net Weight(kg): " + objQuot.NetWeight; pdfbody += "</th>"; pdfbody += "</tr>"; pdfbody += "</tbody>"; pdfbody += "</table>"; pdfbody += "<table border='1' cellpadding='5' cellspacing='0' style='font-size: medium'>"; pdfbody += "<tbody >"; pdfbody += "<tr>"; pdfbody += "<th width='5%' style='text-align:left; width:5%'>"; pdfbody += "<b>II</b>"; pdfbody += "</th>"; pdfbody += "<th style='text-align:left'>"; pdfbody += "Raw Material Cost Details"; // table inside th pdfbody += "<table border='1' cellpadding='2' cellspacing='0'>"; pdfbody += "<tbody>"; pdfbody += "<tr>"; pdfbody += "<th style='text-align:left' bgcolor='#f1f1f1' width='50%'>"; pdfbody += "Particulars"; pdfbody += "</th>"; pdfbody += "<th style='text-align:left' bgcolor='#f1f1f1'>"; pdfbody += "Basic Rate (Rs/kg)"; pdfbody += "</th>"; pdfbody += "<th style='text-align:left' bgcolor='#f1f1f1'>"; pdfbody += "Net Cost (Rs)"; pdfbody += "</th>"; pdfbody += "</tr>"; pdfbody += "<tr>"; pdfbody += "<th style='text-align:left'>"; pdfbody += "Steel Cost"; pdfbody += "</th>"; pdfbody += "<th style='text-align:right'>"; pdfbody += objQuot.SteelCost; pdfbody += "</th>"; pdfbody += "<th style='text-align:right'>"; pdfbody += Convert.ToDecimal(objQuot.SteelCost * objQuot.GrossWeight).ToString("0.00"); pdfbody += "</th>"; pdfbody += "</tr>"; pdfbody += "<tr>"; pdfbody += "<th style='text-align:left'>"; pdfbody += "Transportation"; pdfbody += "</th>"; pdfbody += "<th style='text-align:right'>"; pdfbody += objQuot.Transportation; pdfbody += "</th>"; pdfbody += "<th style='text-align:right'>"; pdfbody += Convert.ToDecimal(objQuot.Transportation * objQuot.GrossWeight).ToString("0.00"); pdfbody += "</th>"; pdfbody += "</tr>"; pdfbody += "<tr>"; pdfbody += "<th style='text-align:left'>"; pdfbody += "Total"; pdfbody += "</th>"; pdfbody += "<th style='text-align:right'>"; pdfbody += Convert.ToDecimal(objQuot.SteelCost + objQuot.Transportation).ToString("0.00"); pdfbody += "</th>"; pdfbody += "<th style='text-align:right'>"; pdfbody += objQuot.TotalRowMaterialCost; pdfbody += "</th>"; pdfbody += "</tr>"; pdfbody += "</tbody>"; pdfbody += "</table>"; pdfbody += "</th>"; pdfbody += "</tr>"; pdfbody += "</tbody>"; pdfbody += "</table>"; // ************** //doc.Add(Chunk.NEWLINE); //hw.Parse(new StringReader(pdfbody)); pdfbody += "<table border='1' cellpadding='5' cellspacing='0'style='font-size: medium'>"; pdfbody += "<tbody >"; pdfbody += "<tr>"; pdfbody += "<th width='5%' style='text-align:left; width:5%'>"; pdfbody += "<b>III</b>"; pdfbody += "</th>"; pdfbody += "<th style='text-align:left'>"; pdfbody += "Conversion Rate Details <br />"; // table inside th pdfbody += "<table border='1' cellpadding='2' cellspacing='0'>"; pdfbody += "<tbody >"; pdfbody += "<tr>"; pdfbody += "<th style='text-align:left' bgcolor='#f1f1f1' width='50%'>"; pdfbody += "Particulars"; pdfbody += "</th>"; pdfbody += "<th style='text-align:left' bgcolor='#f1f1f1'>"; pdfbody += "Basic Rate (Rs/kg)"; pdfbody += "</th>"; pdfbody += "<th style='text-align:left' bgcolor='#f1f1f1'>"; pdfbody += "Net Cost (Rs)"; pdfbody += "</th>"; pdfbody += "</tr>"; foreach (var item in modelFeasibility.ssmtbl_Feasibility_OperationsInvolvedModel) { if (item.Operations_Involved == 1 && item.Operations_Involved_Select) { pdfbody += "<tr>"; pdfbody += "<th style='text-align:left'>"; pdfbody += "Cutting (Sq In)"; pdfbody += "</th>"; pdfbody += "<th style='text-align:right'>"; pdfbody += objQuot.CuttingSquare1; pdfbody += "</th>"; pdfbody += "<th style='text-align:right'>"; pdfbody += objQuot.CuttingSquare2; pdfbody += "</th>"; pdfbody += "</tr>"; } if (item.Operations_Involved == 2 && item.Operations_Involved_Select) { pdfbody += "<tr>"; pdfbody += "<th style='text-align:left'>"; pdfbody += "Forging"; pdfbody += "</th>"; pdfbody += "<th style='text-align:right'>"; pdfbody += objQuot.Forging1; pdfbody += "</th>"; pdfbody += "<th style='text-align:right'>"; pdfbody += objQuot.Forging1; pdfbody += "</th>"; pdfbody += "</tr>"; } if (item.Operations_Involved == 3 && item.Operations_Involved_Select) { pdfbody += "<tr>"; pdfbody += "<th style='text-align:left'>"; pdfbody += "Heat Treatment Cost (Net Wt)"; pdfbody += "</th>"; pdfbody += "<th style='text-align:right'>"; pdfbody += objQuot.HeatTreatment1; pdfbody += "</th>"; pdfbody += "<th style='text-align:right'>"; pdfbody += objQuot.HeatTreatment2; pdfbody += "</th>"; pdfbody += "</tr>"; } if (item.Operations_Involved == 4 && item.Operations_Involved_Select) { pdfbody += "<tr>"; pdfbody += "<th style='text-align:left'>"; pdfbody += "Shot Blasting (Net Wt)"; pdfbody += "</th>"; pdfbody += "<th style='text-align:right'>"; pdfbody += objQuot.ShotBlasting1; pdfbody += "</th>"; pdfbody += "<th style='text-align:right'>"; pdfbody += objQuot.ShotBlasting2; pdfbody += "</th>"; pdfbody += "</tr>"; } if (item.Operations_Involved == 5 && item.Operations_Involved_Select) { pdfbody += "<tr>"; pdfbody += "<th style='text-align:left'>"; pdfbody += "MPI"; pdfbody += "</th>"; pdfbody += "<th style='text-align:right'>"; pdfbody += objQuot.MPI1; pdfbody += "</th>"; pdfbody += "<th style='text-align:right'>"; pdfbody += objQuot.MPI2; pdfbody += "</th>"; pdfbody += "</tr>"; } if (item.Operations_Involved == 13 && item.Operations_Involved_Select) { pdfbody += "<tr>"; pdfbody += "<th style='text-align:left'>"; pdfbody += "Grinding (Per Piece)"; pdfbody += "</th>"; pdfbody += "<th style='text-align:right'>"; pdfbody += objQuot.Grinding1; pdfbody += "</th>"; pdfbody += "<th style='text-align:right'>"; pdfbody += objQuot.Grinding2; pdfbody += "</th>"; pdfbody += "</tr>"; } if (item.Operations_Involved == 14 && item.Operations_Involved_Select) { pdfbody += "<tr>"; pdfbody += "<th style='text-align:left'>"; pdfbody += "Cold Coining (Per Piece)"; pdfbody += "</th>"; pdfbody += "<th style='text-align:right'>"; pdfbody += objQuot.ColdCoining1; pdfbody += "</th>"; pdfbody += "<th style='text-align:right'>"; pdfbody += objQuot.ColdCoining2; pdfbody += "</th>"; pdfbody += "</tr>"; } if (item.Operations_Involved == 15 && item.Operations_Involved_Select) { pdfbody += "<tr>"; pdfbody += "<th style='text-align:left'>"; pdfbody += "Machining (Per Piece)"; pdfbody += "</th>"; pdfbody += "<th style='text-align:right'>"; pdfbody += objQuot.Machining1; pdfbody += "</th>"; pdfbody += "<th style='text-align:right'>"; pdfbody += objQuot.Machining2; pdfbody += "</th>"; pdfbody += "</tr>"; } } pdfbody += "<tr>"; pdfbody += "<th style='text-align:left'>"; pdfbody += "Die Maintaince Cost (Per Piece)"; pdfbody += "</th>"; pdfbody += "<th style='text-align:right'>"; pdfbody += objQuot.DieMaintenance1; pdfbody += "</th>"; pdfbody += "<th style='text-align:right'>"; pdfbody += objQuot.DieMaintenance2; pdfbody += "</th>"; pdfbody += "</tr>"; pdfbody += "<tr>"; pdfbody += "<th style='text-align:left'>"; pdfbody += "Total Coversion Cost"; pdfbody += "</th>"; pdfbody += "<th style='text-align:right'>"; // pdfbody += Convert.ToDecimal(objQuot.DieMaintenance1+ objQuot.Machining1+ objQuot.ColdCoining1+ objQuot.Grinding1+ objQuot.MPI1+ objQuot.ShotBlasting1+ objQuot.HeatTreatment1 + objQuot.Forging1+ objQuot.CuttingSquare1).ToString("0.00"); pdfbody += ""; pdfbody += "</th>"; pdfbody += "<th style='text-align:right'>"; pdfbody += objQuot.TotalConverstionCost; pdfbody += "</th>"; pdfbody += "</tr>"; pdfbody += "</tbody>"; pdfbody += "</table>"; pdfbody += "</th>"; pdfbody += "</tr>"; pdfbody += "</tbody>"; pdfbody += "</table>"; // ************** //doc.Add(Chunk.NEWLINE); //hw.Parse(new StringReader(pdfbody)); pdfbody += "<table border='1' cellpadding='5' cellspacing='0' style='font-size: medium'>"; pdfbody += "<tbody >"; pdfbody += "<tr>"; pdfbody += "<th width='5%' style='text-align:left; width:5%'>"; pdfbody += "<b>IV</b>"; pdfbody += "</th>"; pdfbody += "<th style='text-align:left'>"; pdfbody += "Total Component Cost (II+III) "; pdfbody += "</th>"; pdfbody += "<th style='text-align:right'>"; pdfbody += +objQuot.TotalComponentCost; pdfbody += "</th>"; pdfbody += "</tr>"; pdfbody += "</tbody>"; pdfbody += "</table>"; //doc.Add(Chunk.NEWLINE); //hw.Parse(new StringReader(pdfbody)); pdfbody += "<table border='1' cellpadding='5' cellspacing='0' style='font-size: medium'>"; pdfbody += "<tbody >"; pdfbody += "<tr>"; pdfbody += "<th width='5%' style='text-align:left; width:5%'>"; pdfbody += "<b>V</b>"; pdfbody += "</th>"; pdfbody += "<th style='text-align:left'>"; pdfbody += "Initial Die Cost "; pdfbody += "</th>"; pdfbody += "<th style='text-align:right'>"; pdfbody += +objQuot.InitialDieCost; pdfbody += "</th>"; pdfbody += "</tr>"; pdfbody += "</tbody>"; pdfbody += "</table>"; //if (objQuot.totallycost!="") //{ // pdfbody += "<table border='1' cellpadding='5' cellspacing='0' style='font-size: medium'>"; // pdfbody += "<tbody >"; // pdfbody += "<tr>"; // pdfbody += "<th width='5%' style='text-align:left; width:5%'>"; // pdfbody += "<b>VI</b>"; // pdfbody += "</th>"; // pdfbody += "<th style='text-align:left'>"; // pdfbody += "Total Other Cost "; // pdfbody += "</th>"; // pdfbody += "<th style='text-align:right'>"; // pdfbody += objQuot.totallycost; // pdfbody += "</th>"; // pdfbody += "</tr>"; // pdfbody += "</tbody>"; // pdfbody += "</table>"; //} // // //doc.Add(Chunk.NEWLINE); //hw.Parse(new StringReader(pdfbody)); pdfbody += "<table border='1' cellpadding='2' cellspacing='0' style='font-size: medium'>"; pdfbody += "<tbody >"; pdfbody += "<tr>"; pdfbody += "<th style='text-align:left'>"; pdfbody += "Terms And Conditions: "; pdfbody += "</th>"; pdfbody += "</tr>"; pdfbody += "<tr>"; var i = 1; foreach (var item in objQuot.ssmtbl_TermsNCondtionModel) { pdfbody += "<th style='text-align:left'>"; pdfbody += +i + ". " + item.TermsNConditionContent; pdfbody += "</th>"; i++; } pdfbody += "</tr>"; pdfbody += "</tbody>"; pdfbody += "</table>"; //doc.Add(Chunk.NEWLINE); //hw.Parse(new StringReader(pdfbody)); //pdfbody += "<table border='1' cellpadding='2' cellspacing='0'>"; //pdfbody += "<tbody >"; //pdfbody += "<tr>"; //pdfbody += "<th style='text-align:left'>"; //pdfbody += "Prepared By:- " + objQuot.Createdby; //pdfbody += "</th>"; //pdfbody += "<th style='text-align:left'>"; //pdfbody += "Approved By:- " + objQuot.ApprovedBy; //pdfbody += "</th>"; //pdfbody += "</tr>"; //pdfbody += "<tr>"; //pdfbody += "<th style='text-align:left'>"; //pdfbody += "Prepared Date:- " + objQuot.CreatedOn.Date.ToString("dd-MMM-yyyy"); //pdfbody += "</th>"; //pdfbody += "<th style='text-align:left'>"; //pdfbody += "Approved Date:- " + objQuot.ApprovalDate.Date.ToString("dd-MMM-yyyy"); //pdfbody += "</th>"; //pdfbody += "</tr>"; //pdfbody += "</tbody>"; //pdfbody += "</table>"; pdfbody += "</div>"; doc.Add(Chunk.NEWLINE); hw.Parse(new StringReader(pdfbody)); doc.Close(); contentType = "application/pdf"; return(File(HttpContext.Server.MapPath("~/PDFFiles/Quotation/") + filenm, contentType, filenm)); } catch (Exception ex) { ErrorHandlerClass.LogError(ex); } // return View(); return(File(HttpContext.Server.MapPath("~/PDFFiles/Quotation/") + filenm, contentType, filenm)); }
public ssmtbl_QuotationModel GetOneQuotationForApproval(string QuotationId) { ssmtbl_QuotationModel objQuot = new ssmtbl_QuotationModel(); try { var connection = gConnection.Connection(); connection.Open(); string sqlstr = "uspGetOneQuotationForApproval"; SqlCommand cmd = new SqlCommand(sqlstr, GlobalVariables.gConn); cmd.CommandType = System.Data.CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@Action", "GetOneQuotationForApproval"); cmd.Parameters.AddWithValue("@QuotationId", QuotationId); SqlDataReader sdr = cmd.ExecuteReader(); while (sdr.Read()) { objQuot.id = Convert.ToInt32(sdr["id"].ToString()); objQuot.InquiryNo = Convert.ToInt32(sdr["InquiryNo"].ToString()); objQuot.QuotationNo = sdr["QuotationNo"].ToString(); objQuot.CustomerName = sdr["CustomerName"].ToString(); objQuot.PartDescription = sdr["PartDescription"].ToString(); objQuot.PartNo = sdr["PartNo"].ToString(); objQuot.HeatTreatmentText = sdr["HeatTreatment"].ToString(); objQuot.Material = sdr["Material"].ToString(); objQuot.VersionNo = sdr["VersionNo"].ToString(); objQuot.Section = sdr["Section"].ToString(); objQuot.MachainedWeight = sdr["MachainedWeight"].ToString(); objQuot.GrossWeight = Convert.ToDecimal(sdr["GrossWeight"].ToString()); objQuot.CutWeight = Convert.ToDecimal(sdr["CutWeight"].ToString()); objQuot.NetWeight = Convert.ToDecimal(sdr["NetWeight"].ToString()); objQuot.ForgingCostBased = sdr["ForgingCostBased"].ToString(); objQuot.MPICostBasedOn = sdr["MPICostBasedOn"].ToString(); objQuot.SteelCost = Convert.ToDecimal(sdr["SteelCost"].ToString()); objQuot.Transportation = Convert.ToDecimal(sdr["Transportation"].ToString()); objQuot.Total = Convert.ToDecimal(sdr["Total"].ToString()); objQuot.TotalRowMaterialCost = Convert.ToDecimal(sdr["TotalRowMaterialCost"].ToString()); objQuot.CuttingSquare1 = (sdr["CuttingSquare1"].ToString()); objQuot.CuttingSquare2 = (sdr["CuttingSquare2"].ToString()); objQuot.Forging1 = (sdr["Forging1"].ToString()); objQuot.Forging2 = (sdr["Forging2"].ToString()); objQuot.HeatTreatment1 = (sdr["HeatTreatment1"].ToString()); objQuot.HeatTreatment2 = (sdr["HeatTreatment2"].ToString()); objQuot.ShotBlasting1 = (sdr["ShotBlasting1"].ToString()); objQuot.ShotBlasting2 = (sdr["ShotBlasting2"].ToString()); objQuot.MPI1 = (sdr["MPI1"].ToString()); objQuot.MPI2 = (sdr["MPI2"].ToString()); objQuot.Grinding1 = (sdr["Grinding1"].ToString()); objQuot.Grinding2 = (sdr["Grinding2"].ToString()); objQuot.ColdCoining1 = (sdr["ColdCoining1"].ToString()); objQuot.ColdCoining2 = (sdr["ColdCoining2"].ToString()); objQuot.Machining1 = (sdr["Machining1"].ToString()); objQuot.Machining2 = (sdr["Machining2"].ToString()); objQuot.DieMaintenance1 = (sdr["DieMaintenance1"].ToString()); objQuot.DieMaintenance2 = (sdr["DieMaintenance2"].ToString()); objQuot.TotalConverstionCost = Convert.ToDecimal(sdr["TotalConverstionCost"].ToString()); objQuot.TotalComponentCost = Convert.ToDecimal(sdr["TotalComponentCost"].ToString()); objQuot.InitialDieCost = Convert.ToDecimal(sdr["InitialDieCost"].ToString()); objQuot.PoNo = sdr["PoNo"].ToString(); objQuot.FileStatus = sdr["FileStatus"].ToString(); objQuot.Comment = sdr["Comment"].ToString(); objQuot.ApprovalDate = Convert.ToDateTime(sdr["ApprovalDate"].ToString()); objQuot.ApprovedBy = sdr["ApprovedBy"].ToString(); objQuot.CreatedOn = Convert.ToDateTime(sdr["CreatedOn"].ToString()); objQuot.Createdby = sdr["Createdby"].ToString(); objQuot.UpdatedOn = Convert.ToDateTime(sdr["UpdatedOn"].ToString()); objQuot.UpdatedBy = sdr["UpdatedBy"].ToString(); objQuot.VersionNo = sdr["VersionNo"].ToString(); objQuot.new_Version_No = Convert.ToInt32(sdr["new_Version_No"].ToString()); objQuot.UserComment = sdr["UserComment"].ToString(); objQuot.hardnessmin = sdr["hardnessmin"].ToString(); objQuot.hardnessmax = sdr["hardnessmax"].ToString(); objQuot.hardnessunits = sdr["hardnessunits"].ToString(); objQuot.address = sdr["address"].ToString(); objQuot.iccoverhadrm = sdr["Iccoverhead"].ToString(); // sdr["Iccoverhead"] as decimal? ?? default(decimal); objQuot.totaliccoverhadrm = sdr["Iccoverheadtotal"].ToString(); //Convert.ToDecimal(sdr["Iccoverheadtotal"].ToString()); objQuot.profitonconversion = sdr["Profitconversion"].ToString(); //Convert.ToDecimal(sdr["Profitconversion"].ToString()); objQuot.totalprofitonconversion = sdr["TotalProfitconversion"].ToString(); //Convert.ToDecimal(sdr["TotalProfitconversion"].ToString()); objQuot.rejection = sdr["Rejection"].ToString(); //Convert.ToDecimal(sdr["Rejection"].ToString()); objQuot.totalrejection = sdr["TotalRejection"].ToString(); //Convert.ToDecimal(sdr["TotalRejection"].ToString()); objQuot.packingtransport = sdr["Packing"].ToString(); //Convert.ToDecimal(sdr["Packing"].ToString()); objQuot.totalpackingtransport = sdr["TotalPacking"].ToString(); //Convert.ToDecimal(sdr["TotalPacking"].ToString()); objQuot.totallycost = sdr["TotallyCost"].ToString(); } sdr.Close(); List <ssmtbl_TermsNCondtionModel> objTCList = new List <ssmtbl_TermsNCondtionModel>(); sqlstr = "Select id, Isnull(QuotationID,0) As QuotationID, Isnull(TermsNConditionID,0) As TermsNConditionID, " + " Isnull(TermsNConditionContent,'') As TermsNConditionContent From ssmtbl_TermsNCondtion where QuotationID=@id and flag = 1"; // Sharad // + " Isnull(TermsNConditionContent,'') As TermsNConditionContent From ssmtbl_TermsNCondtion where id=@id"; // Sharad cmd = new SqlCommand(sqlstr, connection); cmd.Parameters.AddWithValue("@id", objQuot.id); sdr = cmd.ExecuteReader(); while (sdr.Read()) { ssmtbl_TermsNCondtionModel tempobj = new ssmtbl_TermsNCondtionModel(); tempobj.id = Convert.ToInt32(sdr["id"].ToString()); tempobj.QuotationID = Convert.ToInt32(sdr["QuotationID"].ToString()); tempobj.TermsNConditionID = Convert.ToInt32(sdr["TermsNConditionID"].ToString()); tempobj.TermsNConditionContent = sdr["TermsNConditionContent"].ToString(); objTCList.Add(tempobj); } objQuot.ssmtbl_TermsNCondtionModel = objTCList; // Sharad connection.Close(); } catch (Exception ex) { ErrorHandlerClass.LogError(ex); } return(objQuot); }
public string CreateQVersion(ssmtbl_QuotationModel model, int QuotationId) { string result = "Error Updating Quotataion"; try { var connection = gConnection.Connection(); connection.Open(); string sqlstr = "uspInsertQuotationVersion"; SqlCommand cmd = new SqlCommand(sqlstr, GlobalVariables.gConn); cmd.CommandType = System.Data.CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@id", QuotationId); cmd.Parameters.AddWithValue("@InquiryNo", model.InquiryNo); cmd.Parameters.AddWithValue("@QuotationNo", model.QuotationNo); cmd.Parameters.AddWithValue("@CustomerName", model.CustomerName.Trim()); cmd.Parameters.AddWithValue("@PartDescription", model.PartDescription); cmd.Parameters.AddWithValue("@PartNo", model.PartNo); cmd.Parameters.AddWithValue("@HeatTreatment", model.HeatTreatmentID); cmd.Parameters.AddWithValue("@Material", model.Material); // cmd.Parameters.AddWithValue("@Section", model.Section); cmd.Parameters.AddWithValue("@Section", model.SectionId); // Sharad cmd.Parameters.AddWithValue("@MachainedWeight", model.MachainedWeight); cmd.Parameters.AddWithValue("@GrossWeight", model.GrossWeight); cmd.Parameters.AddWithValue("@CutWeight", model.CutWeight); cmd.Parameters.AddWithValue("@NetWeight", model.NetWeight); cmd.Parameters.AddWithValue("@ForgingCostBased", model.ForgingCostBased); cmd.Parameters.AddWithValue("@MPICostBasedOn", model.MPICostBasedOn); cmd.Parameters.AddWithValue("@SteelCost", model.SteelCost); cmd.Parameters.AddWithValue("@Transportation", model.Transportation); cmd.Parameters.AddWithValue("@Total", model.Total); cmd.Parameters.AddWithValue("@TotalRowMaterialCost", model.TotalRowMaterialCost); cmd.Parameters.AddWithValue("@CuttingSquare1", model.CuttingSquare1); cmd.Parameters.AddWithValue("@CuttingSquare2", model.CuttingSquare2); cmd.Parameters.AddWithValue("@Forging1", model.Forging1); cmd.Parameters.AddWithValue("@Forging2", model.Forging2); cmd.Parameters.AddWithValue("@HeatTreatment1", model.HeatTreatment1); cmd.Parameters.AddWithValue("@HeatTreatment2", model.HeatTreatment2); cmd.Parameters.AddWithValue("@ShotBlasting1", model.ShotBlasting1); cmd.Parameters.AddWithValue("@ShotBlasting2", model.ShotBlasting2); cmd.Parameters.AddWithValue("@MPI1", model.MPI1); cmd.Parameters.AddWithValue("@MPI2", model.MPI2); cmd.Parameters.AddWithValue("@Grinding1", model.Grinding1); cmd.Parameters.AddWithValue("@Grinding2", model.Grinding2); cmd.Parameters.AddWithValue("@ColdCoining1", model.ColdCoining1); cmd.Parameters.AddWithValue("@ColdCoining2", model.ColdCoining2); cmd.Parameters.AddWithValue("@Machining1", model.Machining1); cmd.Parameters.AddWithValue("@Machining2", model.Machining2); cmd.Parameters.AddWithValue("@DieMaintenance1", model.DieMaintenance1); cmd.Parameters.AddWithValue("@DieMaintenance2", model.DieMaintenance2); cmd.Parameters.AddWithValue("@Status", InquiryStatus.QuotationPendingForApproval); cmd.Parameters.AddWithValue("@FileStatus", InquiryStatus.QuotationPendingForApproval); cmd.Parameters.AddWithValue("@TotalConverstionCost", model.TotalConverstionCost); cmd.Parameters.AddWithValue("@TotalComponentCost", model.TotalComponentCost); cmd.Parameters.AddWithValue("@InitialDieCost", model.InitialDieCost); cmd.Parameters.AddWithValue("@UserComment", model.UserComment); //var pList = new SqlParameter("@ssmUT_TermsNCondtion_", SqlDbType.Structured); //pList.TypeName = "dbo.ssmUT_TermsNCondtion"; //pList.Value = dt; //cmd.Parameters.Add(pList); cmd.Parameters.AddWithValue("@Createdby", "Test"); cmd.Parameters.AddWithValue("@CreatedOn", StandardDateTime.GetDateTime()); //cmd.Parameters.AddWithValue("@Iccoverhead", model.iccoverhadrm); //cmd.Parameters.AddWithValue("@Iccoverheadtotal", model.totaliccoverhadrm); //cmd.Parameters.AddWithValue("@Profitconversion", model.profitonconversion); //cmd.Parameters.AddWithValue("@TotalProfitconversion", model.totalprofitonconversion); //cmd.Parameters.AddWithValue("@Rejection", model.rejection); //cmd.Parameters.AddWithValue("@TotalRejection", model.totalrejection); //cmd.Parameters.AddWithValue("@Packing", model.packingtransport); //cmd.Parameters.AddWithValue("@TotalPacking", model.totalpackingtransport); //cmd.Parameters.AddWithValue("@TotallyCost", model.totallycost); if (model.iccoverhadrm != " ") { cmd.Parameters.AddWithValue("@Iccoverhead", model.iccoverhadrm); } if (model.totaliccoverhadrm != " ") { cmd.Parameters.AddWithValue("@Iccoverheadtotal", model.totaliccoverhadrm); } if (model.profitonconversion != " ") { cmd.Parameters.AddWithValue("@Profitconversion", model.profitonconversion); } if (model.totalprofitonconversion != " ") { cmd.Parameters.AddWithValue("@TotalProfitconversion", model.totalprofitonconversion); } if (model.rejection != " ") { cmd.Parameters.AddWithValue("@Rejection", model.rejection); } if (model.totalrejection != " ") { cmd.Parameters.AddWithValue("@TotalRejection", model.totalrejection); } if (model.packingtransport != " ") { cmd.Parameters.AddWithValue("@Packing", model.packingtransport); } if (model.totalpackingtransport != " ") { cmd.Parameters.AddWithValue("@TotalPacking", model.totalpackingtransport); } if (model.totallycost != " ") { cmd.Parameters.AddWithValue("@TotallyCost", model.totallycost); } cmd.ExecuteNonQuery(); connection.Close(); result = "Quotation version create Successfully!"; } catch (Exception ex) { Global.ErrorHandlerClass.LogError(ex); } return(result); }
public ssmtbl_QuotationModel GetOneQuotationForApproval(string QuotationId) { ssmtbl_QuotationModel objQuot = new ssmtbl_QuotationModel(); try { string sqlstr = "Select Isnull(id,0) As id, Isnull(InquiryNo,0) As InquiryNo, Isnull(QuotationNo,'') As QuotationNo, " + " Isnull(CustomerName,'') As CustomerName, Isnull(PartDescription,'') As PartDescription, Isnull(PartNo,'') As PartNo, " + " (select Options from LKP_Inquiry_Tb IT where IT.ID=ssmtbl_Quotation.HeatTreatment and Type='Heat Treatment') As HeatTreatment," + " Isnull(Material,'') As Material, Isnull(VersionNo,'') As VersionNo, " + " Isnull(Section,'') As Section, Isnull(MachainedWeight,'') As MachainedWeight, Isnull(GrossWeight,0) As GrossWeight, " + " Isnull(CutWeight,0) As CutWeight, Isnull(NetWeight,0) As NetWeight, Isnull(ForgingCostBased,'') As ForgingCostBased, " + " Isnull(MPICostBasedOn,'') As MPICostBasedOn, Isnull(SteelCost,0) As SteelCost, Isnull(Transportation,0) As Transportation, " + " Isnull(Total,0) As Total, Isnull(TotalRowMaterialCost,0) As TotalRowMaterialCost, Isnull(CuttingSquare1,0) As CuttingSquare1, " + " Isnull(CuttingSquare2,0) As CuttingSquare2, Isnull(Forging1,0) As Forging1, ISNULL(Forging2,0) As Forging2, " + " Isnull(HeatTreatment1,0) As HeatTreatment1, Isnull(HeatTreatment2,0) As HeatTreatment2, Isnull(ShotBlasting1,0) As ShotBlasting1, " + " Isnull(ShotBlasting2,0) As ShotBlasting2, Isnull(MPI1,0) As MPI1, Isnull(MPI2,0) As MPI2, Isnull(Grinding1,0) As Grinding1, " + " Isnull(Grinding2,0) As Grinding2, Isnull(ColdCoining1,0) As ColdCoining1, Isnull(ColdCoining2,0) As ColdCoining2, " + " Isnull(Machining1,0) As Machining1, Isnull(Machining2,0) As Machining2, Isnull(DieMaintenance1,0) As DieMaintenance1, " + " Isnull(DieMaintenance2,0) As DieMaintenance2, Isnull(TotalConverstionCost,0) As TotalConverstionCost, " + " Isnull(TotalComponentCost,0) As TotalComponentCost, Isnull(InitialDieCost,0) As InitialDieCost,Isnull(PoNo,'') As PoNo, " + " Isnull(FileStatus,'') As FileStatus, Isnull(Comment,'') As Comment, Isnull(ApprovalDate,'') As ApprovalDate, " + " Isnull(ApprovedBy,'') As ApprovedBy, Isnull(CreatedOn,'') As CreatedOn, Isnull(Createdby,'') As Createdby, " + " Isnull(UpdatedOn,'') As UpdatedOn, Isnull(UpdatedBy,'') As UpdatedBy, Isnull(new_Version_No,0) As new_Version_No, " + " Isnull(UserComment,'') As UserComment From ssmtbl_Quotation where Isnull(id,0)=@QuotationId"; var connection = gConnection.Connection(); connection.Open(); SqlCommand cmd = new SqlCommand(sqlstr, connection); cmd.Parameters.AddWithValue("@QuotationId", QuotationId); SqlDataReader sdr = cmd.ExecuteReader(); while (sdr.Read()) { objQuot.id = Convert.ToInt32(sdr["id"].ToString()); objQuot.InquiryNo = Convert.ToInt32(sdr["InquiryNo"].ToString()); objQuot.QuotationNo = sdr["QuotationNo"].ToString(); objQuot.CustomerName = sdr["CustomerName"].ToString(); objQuot.PartDescription = sdr["PartDescription"].ToString(); objQuot.PartNo = sdr["PartNo"].ToString(); objQuot.HeatTreatmentText = sdr["HeatTreatment"].ToString(); objQuot.Material = sdr["Material"].ToString(); objQuot.VersionNo = sdr["VersionNo"].ToString(); objQuot.Section = sdr["Section"].ToString(); objQuot.MachainedWeight = sdr["MachainedWeight"].ToString(); objQuot.GrossWeight = Convert.ToDecimal(sdr["GrossWeight"].ToString()); objQuot.CutWeight = Convert.ToDecimal(sdr["CutWeight"].ToString()); objQuot.NetWeight = Convert.ToDecimal(sdr["NetWeight"].ToString()); objQuot.ForgingCostBased = sdr["ForgingCostBased"].ToString(); objQuot.MPICostBasedOn = sdr["MPICostBasedOn"].ToString(); objQuot.SteelCost = Convert.ToDecimal(sdr["SteelCost"].ToString()); objQuot.Transportation = Convert.ToDecimal(sdr["Transportation"].ToString()); objQuot.Total = Convert.ToDecimal(sdr["Total"].ToString()); objQuot.TotalRowMaterialCost = Convert.ToDecimal(sdr["TotalRowMaterialCost"].ToString()); objQuot.CuttingSquare1 = (sdr["CuttingSquare1"].ToString()); objQuot.CuttingSquare2 = (sdr["CuttingSquare2"].ToString()); objQuot.Forging1 = (sdr["Forging1"].ToString()); objQuot.Forging2 = (sdr["Forging2"].ToString()); objQuot.HeatTreatment1 = (sdr["HeatTreatment1"].ToString()); objQuot.HeatTreatment2 = (sdr["HeatTreatment2"].ToString()); objQuot.ShotBlasting1 = (sdr["ShotBlasting1"].ToString()); objQuot.ShotBlasting2 = (sdr["ShotBlasting2"].ToString()); objQuot.MPI1 = (sdr["MPI1"].ToString()); objQuot.MPI2 = (sdr["MPI2"].ToString()); objQuot.Grinding1 = (sdr["Grinding1"].ToString()); objQuot.Grinding2 = (sdr["Grinding2"].ToString()); objQuot.ColdCoining1 = (sdr["ColdCoining1"].ToString()); objQuot.ColdCoining2 = (sdr["ColdCoining2"].ToString()); objQuot.Machining1 = (sdr["Machining1"].ToString()); objQuot.Machining2 = (sdr["Machining2"].ToString()); objQuot.DieMaintenance1 = (sdr["DieMaintenance1"].ToString()); objQuot.DieMaintenance2 = (sdr["DieMaintenance2"].ToString()); objQuot.TotalConverstionCost = Convert.ToDecimal(sdr["TotalConverstionCost"].ToString()); objQuot.TotalComponentCost = Convert.ToDecimal(sdr["TotalComponentCost"].ToString()); objQuot.InitialDieCost = Convert.ToDecimal(sdr["InitialDieCost"].ToString()); objQuot.PoNo = sdr["PoNo"].ToString(); objQuot.FileStatus = sdr["FileStatus"].ToString(); objQuot.Comment = sdr["Comment"].ToString(); objQuot.ApprovalDate = Convert.ToDateTime(sdr["ApprovalDate"].ToString()); objQuot.ApprovedBy = sdr["ApprovedBy"].ToString(); objQuot.CreatedOn = Convert.ToDateTime(sdr["CreatedOn"].ToString()); objQuot.Createdby = sdr["Createdby"].ToString(); objQuot.UpdatedOn = Convert.ToDateTime(sdr["UpdatedOn"].ToString()); objQuot.UpdatedBy = sdr["UpdatedBy"].ToString(); objQuot.VersionNo = sdr["VersionNo"].ToString(); objQuot.new_Version_No = Convert.ToInt32(sdr["new_Version_No"].ToString()); objQuot.UserComment = sdr["UserComment"].ToString(); } sdr.Close(); List <ssmtbl_TermsNCondtionModel> objTCList = new List <ssmtbl_TermsNCondtionModel>(); sqlstr = "Select id, Isnull(QuotationID,0) As QuotationID, Isnull(TermsNConditionID,0) As TermsNConditionID, " + " Isnull(TermsNConditionContent,'') As TermsNConditionContent From ssmtbl_TermsNCondtion where QuotationID=@id"; //+" Isnull(TermsNConditionContent,'') As TermsNConditionContent From ssmtbl_TermsNCondtion where id=@id"; cmd = new SqlCommand(sqlstr, connection); cmd.Parameters.AddWithValue("@id", objQuot.id); sdr = cmd.ExecuteReader(); while (sdr.Read()) { ssmtbl_TermsNCondtionModel tempobj = new ssmtbl_TermsNCondtionModel(); tempobj.id = Convert.ToInt32(sdr["id"].ToString()); tempobj.QuotationID = Convert.ToInt32(sdr["QuotationID"].ToString()); tempobj.TermsNConditionID = Convert.ToInt32(sdr["TermsNConditionID"].ToString()); tempobj.TermsNConditionContent = sdr["TermsNConditionContent"].ToString(); objTCList.Add(tempobj); } connection.Close(); } catch (Exception ex) { ErrorHandlerClass.LogError(ex); } return(objQuot); }
public ssmtbl_QuotationModel GetLetestQuotationID(long id) { var connection = gConnection.Connection(); ssmtbl_QuotationModel model = new ssmtbl_QuotationModel(); ssmtbl_FeasibilityModel fismodel = new ssmtbl_FeasibilityModel(); try { sqlstr = "select * from ssmtbl_Quotation where CreatedOn=(select max(CreatedOn) FROM ssmtbl_Quotation where InquiryNo=@InquiryNo )"; //sqlstr = "SELECT TOP 1 * FROM QuotationVersion where InquiryNo=77 order by Qid desc"; connection.Open(); SqlCommand cmd = new SqlCommand(sqlstr, connection); cmd.Parameters.AddWithValue("@InquiryNo", id); SqlDataReader sdr = cmd.ExecuteReader(); while (sdr.Read()) { model.id = Convert.ToInt32(sdr["id"]); model.QuotationId = Convert.ToInt32(sdr["id"]); model.InquiryNo = Convert.ToInt32(sdr["InquiryNo"].ToString()); model.QuotationNo = sdr["QuotationNo"].ToString(); model.CustomerName = sdr["CustomerName"].ToString(); model.PartDescription = sdr["PartDescription"].ToString(); model.PartNo = sdr["PartNo"].ToString(); var getMaterialGrad = objDrop.FeasibilityMaterialGrade().FirstOrDefault(m => m.Value == sdr["Material"].ToString()); if (getMaterialGrad != null) { model.Material = getMaterialGrad.Text; } var getHeattreatment = objDrop.FeasibilityHeatTreatment().FirstOrDefault(m => m.Value == sdr["HeatTreatment"].ToString()); if (getHeattreatment != null) { model.HeatTreatmentID = getHeattreatment.Value; model.HeatTreatmentText = getHeattreatment.Text; } model.VersionNo = sdr["VersionNo"].ToString(); model.Section = sdr["Section"].ToString(); model.MachainedWeight = sdr["MachainedWeight"].ToString(); model.GrossWeight = Convert.ToDecimal(sdr["GrossWeight"].ToString()); model.CutWeight = Convert.ToDecimal(sdr["CutWeight"].ToString()); model.NetWeight = Convert.ToDecimal(sdr["NetWeight"].ToString()); model.ForgingCostBased = sdr["ForgingCostBased"].ToString(); model.MPICostBasedOn = sdr["MPICostBasedOn"].ToString(); model.SteelCost = Convert.ToDecimal(sdr["SteelCost"].ToString()); model.Transportation = Convert.ToDecimal(sdr["Transportation"].ToString()); model.Total = Convert.ToDecimal(sdr["Total"].ToString()); model.TotalRowMaterialCost = Convert.ToDecimal(sdr["TotalRowMaterialCost"].ToString()); model.CuttingSquare1 = (sdr["CuttingSquare1"].ToString()); model.CuttingSquare2 = (sdr["CuttingSquare2"].ToString()); model.Forging1 = (sdr["Forging1"].ToString()); model.Forging2 = (sdr["Forging2"].ToString()); model.HeatTreatment1 = (sdr["HeatTreatment1"].ToString()); model.HeatTreatment2 = (sdr["HeatTreatment2"].ToString()); model.ShotBlasting1 = (sdr["ShotBlasting1"].ToString()); model.ShotBlasting2 = (sdr["ShotBlasting2"].ToString()); model.MPI1 = (sdr["MPI1"].ToString()); model.MPI2 = (sdr["MPI2"].ToString()); model.Grinding1 = (sdr["Grinding1"].ToString()); model.Grinding2 = (sdr["Grinding2"].ToString()); model.ColdCoining1 = (sdr["ColdCoining1"].ToString()); model.ColdCoining2 = (sdr["ColdCoining2"].ToString()); model.Machining1 = (sdr["Machining1"].ToString()); model.Machining2 = (sdr["Machining2"].ToString()); model.DieMaintenance1 = (sdr["DieMaintenance1"].ToString()); model.DieMaintenance2 = (sdr["DieMaintenance2"].ToString()); model.TotalConverstionCost = Convert.ToDecimal(sdr["TotalConverstionCost"].ToString()); model.TotalComponentCost = Convert.ToDecimal(sdr["TotalComponentCost"].ToString()); model.InitialDieCost = Convert.ToDecimal(sdr["InitialDieCost"].ToString()); model.PoNo = sdr["PoNo"].ToString(); model.FileStatus = sdr["FileStatus"].ToString(); model.Comment = sdr["Comment"].ToString(); model.ApprovalDate = (string.IsNullOrEmpty(sdr["ApprovalDate"].ToString())) ? default(DateTime) : Convert.ToDateTime(sdr["ApprovalDate"].ToString()); model.ApprovedBy = sdr["ApprovedBy"].ToString(); model.CreatedOn = Convert.ToDateTime(sdr["CreatedOn"].ToString()); model.Createdby = sdr["Createdby"].ToString(); model.UpdatedOn = (string.IsNullOrEmpty(sdr["UpdatedOn"].ToString())) ? default(DateTime) : Convert.ToDateTime(sdr["UpdatedOn"].ToString()); model.UpdatedBy = sdr["UpdatedBy"].ToString(); model.VersionNo = sdr["VersionNo"].ToString(); model.new_Version_No = Convert.ToInt32(sdr["new_Version_No"].ToString()); model.UserComment = sdr["UserComment"].ToString(); model.iccoverhadrm = sdr["Iccoverhead"].ToString(); // sdr["Iccoverhead"] as decimal? ?? default(decimal); model.totaliccoverhadrm = sdr["Iccoverheadtotal"].ToString(); //Convert.ToDecimal(sdr["Iccoverheadtotal"].ToString()); model.profitonconversion = sdr["Profitconversion"].ToString(); //Convert.ToDecimal(sdr["Profitconversion"].ToString()); model.totalprofitonconversion = sdr["TotalProfitconversion"].ToString(); //Convert.ToDecimal(sdr["TotalProfitconversion"].ToString()); model.rejection = sdr["Rejection"].ToString(); //Convert.ToDecimal(sdr["Rejection"].ToString()); model.totalrejection = sdr["TotalRejection"].ToString(); //Convert.ToDecimal(sdr["TotalRejection"].ToString()); model.packingtransport = sdr["Packing"].ToString(); //Convert.ToDecimal(sdr["Packing"].ToString()); model.totalpackingtransport = sdr["TotalPacking"].ToString(); //Convert.ToDecimal(sdr["TotalPacking"].ToString()); model.totallycost = sdr["TotallyCost"].ToString(); } connection.Close(); //////////////// //sqlstr1 = "select * from ssmtbl_Feasibility where InquiryNo=@InquiryNo"; //connection.Open(); //SqlCommand cmd1 = new SqlCommand(sqlstr1, connection); //cmd1.Parameters.AddWithValue("@InquiryNo", id); //SqlDataReader sdr1 = cmd1.ExecuteReader(); //while (sdr1.Read()) //{ // fismodel.hardnessmin = sdr1["hardnessmin"].ToString(); // fismodel.hardnessmax = sdr1["hardnessmax"].ToString(); // fismodel.hardnessunits = sdr1["hardnessunits"].ToString(); //} //connection.Close(); } catch (Exception ex) { ErrorHandlerClass.LogError(ex); connection.Close(); } return(model); }