protected void GetSavedItems(string status) { var ldata = PO_Detail.RetrieveData(oCon, Session["idPOHeader"].ToString(), ""); //Session["Data"] = ldata; gvItems.DataSource = ldata; gvItems.DataBind(); gvItems.GridLines = GridLines.None; if (status == "Recieved" || status == "Announced") { var ldata2 = PO_Charges.RetrieveData(oCon, Session["idPOHeader"].ToString()); txtBrokerage.Text = ldata2[0].Brokerage.ToString(); txtCEDEC.Text = ldata2[0].CEDEC.ToString(); txtCustomsStamps.Text = ldata2[0].CustomsStamps.ToString(); txtDeliveryCharges.Text = ldata2[0].DeliveryCharges.ToString(); txtDocumentaryStamps.Text = ldata2[0].DocumentaryStamps.ToString(); txtDocumentationCharges.Text = ldata2[0].DocumentationCharges.ToString(); txtForkliftCost.Text = ldata2[0].ForkliftCost.ToString(); txtFreightCharges.Text = ldata2[0].FreightCharges.ToString(); txtHandlingFee.Text = ldata2[0].HandlingFee.ToString(); txtImportDuties.Text = ldata2[0].ImportDuties.ToString(); txtImportProcessingFee.Text = ldata2[0].ImportProcessingFee.ToString(); txtImportationInsurance.Text = ldata2[0].ImportationInsurance.ToString(); txtMiscellaneous.Text = ldata2[0].Miscellaneous.ToString(); txtNotarialFee.Text = ldata2[0].NotarialFee.ToString(); txtOtherCharges.Text = ldata2[0].OtherCharges.ToString(); txtProcessingFee.Text = ldata2[0].ProcessingFee.ToString(); txtWarehouseStorageCharges.Text = ldata2[0].WarehouseStorageCharges.ToString(); txtXerox.Text = ldata2[0].Xerox.ToString(); //var detail = Import_Shipment_Detail.RetrieveData(oCon, 0, Convert.ToInt32(Session["idPOHeader"].ToString())); //var head = Import_Shipment_Header.RetrieveData(oCon, detail[0].idImpShpHead, ""); //txtImpShpNum.Text = head[0].ImportShipmentNumber; } else if (status == "Sent") { txtBrokerage.Text = "0"; txtCEDEC.Text = "0"; txtCustomsStamps.Text = "0"; txtDeliveryCharges.Text = "0"; txtDocumentaryStamps.Text = "0"; txtDocumentationCharges.Text = "0"; txtForkliftCost.Text = "0"; txtFreightCharges.Text = "0"; txtHandlingFee.Text = "0"; txtImportDuties.Text = "0"; txtImportProcessingFee.Text = "0"; txtImportationInsurance.Text = "0"; txtMiscellaneous.Text = "0"; txtNotarialFee.Text = "0"; txtOtherCharges.Text = "0"; txtProcessingFee.Text = "0"; txtWarehouseStorageCharges.Text = "0"; txtXerox.Text = "0"; } }
protected void btnSave_Click(object sender, EventArgs e) { if (Convert.ToBoolean(Session["ComputeClick"]) == true) { foreach (GridViewRow row in gvItems.Rows) { var objPODetail = new PO_Detail_Model { idPODetail = int.Parse(row.Cells[0].Text), idPOHeader = int.Parse(row.Cells[1].Text), idItem = int.Parse(row.Cells[2].Text), Quantity = decimal.Parse(row.Cells[5].Text), Price = decimal.Parse(row.Cells[6].Text), Tax = decimal.Parse(row.Cells[7].Text), Amount = decimal.Parse(row.Cells[8].Text), Final_Cost = decimal.Parse(row.Cells[9].Text), Unit_Comp = row.Cells[10].Text, isReceived = "No", Partial_Remaining = 0 }; PO_Detail.Update(oCon, objPODetail); } var pO_Charges_Model = new PO_Charges_Model { idPOHeader = Convert.ToInt32(Session["idPOHeader"].ToString()), Brokerage = Convert.ToDecimal(txtBrokerage.Text), CEDEC = Convert.ToDecimal(txtCEDEC.Text), CustomsStamps = Convert.ToDecimal(txtCustomsStamps.Text), DeliveryCharges = Convert.ToDecimal(txtDeliveryCharges.Text), DocumentaryStamps = Convert.ToDecimal(txtDocumentaryStamps.Text), DocumentationCharges = Convert.ToDecimal(txtDocumentationCharges.Text), ForkliftCost = Convert.ToDecimal(txtForkliftCost.Text), FreightCharges = Convert.ToDecimal(txtFreightCharges.Text), HandlingFee = Convert.ToDecimal(txtHandlingFee.Text), ImportationInsurance = Convert.ToDecimal(txtImportationInsurance.Text), ImportDuties = Convert.ToDecimal(txtImportDuties.Text), ImportProcessingFee = Convert.ToDecimal(txtImportProcessingFee.Text), Miscellaneous = Convert.ToDecimal(txtMiscellaneous.Text), NotarialFee = Convert.ToDecimal(txtNotarialFee.Text), OtherCharges = Convert.ToDecimal(txtOtherCharges.Text), ProcessingFee = Convert.ToDecimal(txtProcessingFee.Text), WarehouseStorageCharges = Convert.ToDecimal(txtWarehouseStorageCharges.Text), Xerox = Convert.ToDecimal(txtXerox.Text) }; PO_Charges.Save(oCon, pO_Charges_Model); var poheader = new PO_Header_Model { idPOHeader = Convert.ToInt32(Session["idPOHeader"].ToString()), POStatus = "Announced", Total_Charges = Convert.ToDecimal(txtTotalCharges.Text), ImportShipmentNumber = txtImpShpNum.Text }; PO_Header.UpdatePOStatus(oCon, poheader); PO_Header.UpdateTotalCharges(oCon, poheader); defaultSettings(); GetPO(); } else { HttpContext.Current.Response.Write("<script>alert(" + ControlChars.Quote + "Cost not yet computed!" + ControlChars.Quote + ");</script>"); } }