public JobPOModel GetJobPODetails(int POId) { var returnedJobPO = jmdc.GetJobPODetails(POId); foreach (GetJobPODetailsResult jm in returnedJobPO) { JobPOModel jobPODetails = new JobPOModel(); jobPODetails.JobId = jm.JobId; jobPODetails.POId = jm.Id; jobPODetails.VendorId = jm.VendorId; jobPODetails.StatusId = jm.StatusId; jobPODetails.CreatedBy = jm.CreatedBy; jobPODetails.CreatedOn = jm.CreatedOn; jobPODetails.ApprovedById = jm.ApprovedById; jobPODetails.ApprovedBy = jm.ApprovedBy; jobPODetails.ApprovedOn = jm.ApprovedOn; jobPODetails.Discount = jm.Discount; jobPODetails.Delivery = jm.Delivery; jobPODetails.Payment = jm.Payment; jobPODetails.Packing = jm.Packing; jobPODetails.ExciseDuty = jm.ExciseDuty; jobPODetails.TaxesExtra = jm.TaxesExtra; jobPODetails.TransportInsurance = jm.TransitInsurance; jobPODetails.Transportation = jm.Transportation; jobPODetails.Octroi = jm.Octroi; jobPODetails.PONumber = jm.Fiscal_Year.ToString() + "/" + jm.Id + "/" + jm.JobId; return(jobPODetails); } return(null); }
private void UserControl_Loaded(object sender, RoutedEventArgs e) { DataTable dtCompanyDetails = new DataTable(); PurchaseOrder objPurchaseOrder = objDataAccess.GetPurchaseOrderById(Convert.ToInt32(ReportId)); List <JobPOMaterialModel> lJobMaterials = objDataAccess.GetJobPOMaterials(objPurchaseOrder.JobId, objPurchaseOrder.Id); JobPOModel objJobPOModel = objDataAccess.GetJobPODetails(objPurchaseOrder.Id); JobModel objJobDetails = objDataAccess.GetJobDetails(objPurchaseOrder.JobId); if (objJobDetails.BranchId != null) { dtCompanyDetails = CompanyDetails(Convert.ToInt32(objJobDetails.BranchId)); } DataTable dtToDetails = GetVendorDetails(objPurchaseOrder); DataTable dtReportContents = ReportContents(lJobMaterials); decimal? dTotalValue; DataTable dtTermsConditions = Terms_ConditionsContent(objJobPOModel, out dTotalValue); DataTable dtTotal = new DataTable(); dtTotal.Columns.Add("TotalValue", typeof(decimal)); DataRow drTotalRow = dtTotal.NewRow(); drTotalRow["TotalValue"] = Convert.ToDecimal(dTotalValue); dtTotal.Rows.Add(drTotalRow); ReportDataSource rhCompanyDetailsDataSource = new ReportDataSource("rhCompanyDetails", dtCompanyDetails); ReportDataSource rhToDetailsDataSource = new ReportDataSource("rhToDetail", dtToDetails); ReportDataSource rhReportContentsDataSource = new ReportDataSource("rhContents", dtReportContents); ReportDataSource rhReportTermsConditions = new ReportDataSource("rhTerms_Conditions", dtTermsConditions); ReportDataSource rh_Total = new ReportDataSource("rh_Total", dtTotal); reportViewer.LocalReport.ReportPath = "PurchaseOrderReport.rdlc"; reportViewer.LocalReport.DataSources.Add(rhCompanyDetailsDataSource); reportViewer.LocalReport.DataSources.Add(rhToDetailsDataSource); reportViewer.LocalReport.DataSources.Add(rhReportContentsDataSource); reportViewer.LocalReport.DataSources.Add(rhReportTermsConditions); reportViewer.LocalReport.DataSources.Add(rh_Total); reportViewer.RefreshReport(); }
public void LoadJobPODetails() { List <Vendor> vendors = da.GetAllVendors(); Vendor selectitem = new Vendor(); selectitem.VendorId = -1; selectitem.VendorName = "<Select>"; vendors.Insert(0, selectitem); cmbVendor.DisplayMemberPath = "VendorName"; cmbVendor.SelectedValuePath = "VendorId"; cmbVendor.ItemsSource = vendors; cmbVendor.SelectedValue = -1; List <JobPOStatus> js = da.GetJobPOStatuses(); cmbStatus.DisplayMemberPath = "Name"; cmbStatus.SelectedValuePath = "Id"; cmbStatus.ItemsSource = js; cmbStatus.SelectedValue = 1; List <JobPOMaterialModel> materials = new List <JobPOMaterialModel>(); if (POId != 0) { jobPO = da.GetJobPODetails(POId); this.txtPONumber.Text = jobPO.PONumber; this.txtDiscount.Text = jobPO.Discount.ToString(); this.txtDelivery.Text = jobPO.Delivery.ToString(); this.txtPayment.Text = jobPO.Payment.ToString(); this.txtPacking.Text = jobPO.Packing.ToString(); this.txtExciseDuty.Text = jobPO.ExciseDuty.ToString(); this.txtTaxesExtra.Text = jobPO.TaxesExtra.ToString(); this.txtTransitInsurance.Text = jobPO.TransportInsurance.ToString(); this.txtTransportation.Text = jobPO.Transportation.ToString(); this.txtOctroi.Text = jobPO.Octroi.ToString(); this.cmbVendor.SelectedValue = jobPO.VendorId; this.txtCreatedBy.Text = jobPO.CreatedBy; this.txtCreatedOn.Text = jobPO.CreatedOn.ToString(); this.txtApprovedBy.Text = jobPO.ApprovedBy; if (jobPO.ApprovedOn.HasValue) { this.txtApprovedOn.Text = jobPO.ApprovedOn.ToString(); } cmbStatus.SelectedValue = jobPO.StatusId; materials = da.GetJobPOMaterials(jobId, POId); } else { List <JobPOMaterialModel> allMaterials = da.GetJobPOMaterials(jobId, null); foreach (JobPOMaterialModel jobpom in allMaterials) { if (lJobMaterials.Find(p => p.Id == jobpom.Id) != null) { materials.Add(jobpom); } } } dgJobMaterials.ItemsSource = materials; }
private void btnSave_Click(object sender, RoutedEventArgs e) { if (Convert.ToInt32(cmbVendor.SelectedValue) == -1) { MessageBox.Show("Please select Vendor", "Validation"); this.cmbVendor.Focus(); return; } if (this.jobPO == null) { jobPO = new JobPOModel(); } jobPO.VendorId = Convert.ToInt32(this.cmbVendor.SelectedValue); jobPO.JobId = jobId; jobPO.CreatedById = 1; // TODO check with Bhuvan how to get logged in user id jobPO.StatusId = Convert.ToInt32(this.cmbStatus.SelectedValue); if (this.txtDiscount.Text != "") { jobPO.Discount = Convert.ToDecimal(this.txtDiscount.Text); } if (this.txtDelivery.Text != "") { jobPO.Delivery = Convert.ToDecimal(this.txtDelivery.Text); } if (this.txtPayment.Text != "") { jobPO.Payment = Convert.ToDecimal(this.txtPayment.Text); } if (this.txtPacking.Text != "") { jobPO.Packing = Convert.ToDecimal(this.txtPacking.Text); } if (this.txtExciseDuty.Text != "") { jobPO.ExciseDuty = Convert.ToDecimal(this.txtExciseDuty.Text); } if (this.txtTaxesExtra.Text != "") { jobPO.TaxesExtra = Convert.ToDecimal(this.txtTaxesExtra.Text); } if (this.txtTransitInsurance.Text != "") { jobPO.TransportInsurance = Convert.ToDecimal(this.txtTransitInsurance.Text); } if (this.txtTransportation.Text != "") { jobPO.Transportation = Convert.ToDecimal(this.txtTransportation.Text); } if (this.txtOctroi.Text != "") { jobPO.Octroi = Convert.ToDecimal(this.txtOctroi.Text); } if (jobPO.ApprovedById == null && jobPO.StatusId == 2) { jobPO.ApprovedById = 1; // TODO check with Bhuvan how to get logged in user id jobPO.ApprovedOn = DateTime.Now; } if (POId == 0) { POId = da.InsJobPO(jobPO); foreach (JobPOMaterialModel jpm in dgJobMaterials.Items) { da.InsJobPOMaterila(POId, jobId, jpm); } } else { jobPO.ModifiedById = 1; //TODO check with Bhuvan how to get logged in user id da.DelPOMaterials(POId); da.UpdJobPO(jobPO); foreach (JobPOMaterialModel jpm in dgJobMaterials.Items) { da.InsJobPOMaterila(POId, jobId, jpm); } } LoadJobPODetails(); MessageBox.Show("Purchase Order Saved Sucessfully", "Information"); var myObject = this.Owner as JobDetails; myObject.LoadJobDetails(); }
public int InsJobPO(JobPOModel jobPO) { var result = jmdc.INSJobPO(jobPO.JobId, jobPO.CreatedById, jobPO.VendorId, jobPO.Discount, jobPO.Delivery, jobPO.Payment, jobPO.Packing, jobPO.ExciseDuty, jobPO.TaxesExtra, jobPO.TransportInsurance, jobPO.Transportation, jobPO.Octroi); return(Convert.ToInt32(result.Single <INSJobPOResult>().Column1)); }
public void UpdJobPO(JobPOModel jobPO) { jmdc.UPDJobPODetails(jobPO.POId, jobPO.ModifiedById, jobPO.VendorId, jobPO.StatusId, jobPO.ApprovedById, jobPO.ApprovedOn, jobPO.Discount, jobPO.Delivery, jobPO.Payment, jobPO.Packing, jobPO.ExciseDuty, jobPO.TaxesExtra, jobPO.TransportInsurance, jobPO.Transportation, jobPO.Octroi); }
private DataTable Terms_ConditionsContent(JobPOModel objJobPOModel, out decimal?iTotal) { DataTable dtTCContents = new DataTable(); dtTCContents.Columns.Add(new DataColumn("Terms_Conditions", typeof(string))); dtTCContents.Columns.Add(new DataColumn("Details", typeof(decimal))); dtTCContents.Columns.Add(new DataColumn("Amount", typeof(decimal))); iTotal = iTotalAmount; DataRow drNewRow = dtTCContents.NewRow(); drNewRow["Terms_Conditions"] = "Discount"; drNewRow["Details"] = objJobPOModel.Discount; drNewRow["Amount"] = objJobPOModel.Discount; iTotal = iTotal - objJobPOModel.Discount; dtTCContents.Rows.Add(drNewRow); drNewRow = dtTCContents.NewRow(); drNewRow["Terms_Conditions"] = "Advance Payment"; drNewRow["Details"] = Convert.ToDecimal(objJobPOModel.Payment); drNewRow["Amount"] = Convert.ToDecimal(objJobPOModel.Payment); iTotal = iTotal - objJobPOModel.Payment; dtTCContents.Rows.Add(drNewRow); drNewRow = dtTCContents.NewRow(); drNewRow["Terms_Conditions"] = "Delivery"; drNewRow["Details"] = Convert.ToDecimal(objJobPOModel.Delivery); drNewRow["Amount"] = Convert.ToDecimal(objJobPOModel.Delivery); iTotal = iTotal + Convert.ToDecimal(objJobPOModel.Delivery); dtTCContents.Rows.Add(drNewRow); decimal dPacking = Convert.ToDecimal(objJobPOModel.Packing); drNewRow = dtTCContents.NewRow(); drNewRow["Terms_Conditions"] = "Packing"; drNewRow["Details"] = dPacking; drNewRow["Amount"] = (dPacking * iTotalAmount) / 100; iTotal = iTotal + ((dPacking * iTotalAmount) / 100); dtTCContents.Rows.Add(drNewRow); decimal dExciseDuty = Convert.ToDecimal(objJobPOModel.ExciseDuty); drNewRow = dtTCContents.NewRow(); drNewRow["Terms_Conditions"] = "Excise Duty"; drNewRow["Details"] = dExciseDuty; drNewRow["Amount"] = (dExciseDuty * iTotalAmount) / 100; iTotal = iTotal + ((dExciseDuty * iTotalAmount) / 100); dtTCContents.Rows.Add(drNewRow); decimal dTransportInsurance = Convert.ToDecimal(objJobPOModel.TransportInsurance); drNewRow = dtTCContents.NewRow(); drNewRow["Terms_Conditions"] = "Transport Insurance"; drNewRow["Details"] = dTransportInsurance; drNewRow["Amount"] = (dTransportInsurance * iTotalAmount) / 100; iTotal = iTotal + ((dTransportInsurance * iTotalAmount) / 100); dtTCContents.Rows.Add(drNewRow); decimal dTransportation = Convert.ToDecimal(objJobPOModel.TransportInsurance); drNewRow = dtTCContents.NewRow(); drNewRow["Terms_Conditions"] = "Transportation"; drNewRow["Details"] = dTransportation; drNewRow["Amount"] = (dTransportation * iTotalAmount) / 100; iTotal = iTotal + ((dTransportation * iTotalAmount) / 100); dtTCContents.Rows.Add(drNewRow); decimal dOctroi = Convert.ToDecimal(objJobPOModel.TransportInsurance); drNewRow = dtTCContents.NewRow(); drNewRow["Terms_Conditions"] = "Octroi"; drNewRow["Details"] = dOctroi; drNewRow["Amount"] = (dOctroi * iTotalAmount) / 100; iTotal = iTotal + ((dOctroi * iTotalAmount) / 100); dtTCContents.Rows.Add(drNewRow); decimal taxes = Convert.ToDecimal(objJobPOModel.TaxesExtra); drNewRow = dtTCContents.NewRow(); drNewRow["Terms_Conditions"] = "Service Tax"; drNewRow["Details"] = taxes; drNewRow["Amount"] = (taxes * iTotalAmount) / 100; iTotal = iTotal + ((taxes * iTotalAmount) / 100); dtTCContents.Rows.Add(drNewRow); drNewRow = dtTCContents.NewRow(); drNewRow["Terms_Conditions"] = "Round Off"; drNewRow["Details"] = 0.00; drNewRow["Amount"] = 0.00; dtTCContents.Rows.Add(drNewRow); return(dtTCContents); }