var Obj_SalaryAndTaxInfo = (from p in t.Tbl_Designations where words.Contains(p.ResourceType) select p).FirstOrDefault();
protected void RetriveInvoice_Click(object sender, EventArgs e) { List<getsal> getsalaries = new List<getsal>(); try { //int sequenceNumber = 5; //string id = string.Format("PT{0}", sequenceNumber.ToString().PadLeft(13, '0')); var Otsi_orders = (from p in t.Tbl_OtsiCreatedWorkOrders where p.WorkOrderNO == ddlWorkOrder.SelectedValue select p).FirstOrDefault(); GetInvoiceOnMonth_Result Invoice_Month = t.GetInvoiceOnMonth(ddlWorkOrder.SelectedValue, DLMonth.Text, DLYear.Text).FirstOrDefault(); if (Otsi_orders != null && Invoice_Month != null) { decimal SalaryPerDay=0; BtnPrintSalaryList.Visible = true; //code Added var resourceType = t.Tbl_HMWSSBWorkOrders.Select(a => a).Where(a => a.WorkOrderNO == ddlWorkOrder.SelectedValue).FirstOrDefault(); var s = resourceType.Resource_Type; char[] delimiterChars = { ',' }; string NewString = s; string strresource = NewString.TrimEnd(delimiterChars); string[] words = strresource.Split(delimiterChars); Tbl_Designations Obj_SalaryAndTaxInfo = new Tbl_Designations(); // Obj_SalaryAndTaxInfo = (from p in t.Tbl_Designations where words.Contains(p.ResourceType) select p).FirstOrDefault(); foreach (string item in words) { Obj_SalaryAndTaxInfo = t.Tbl_Designations.Select(x => x).Where(x => x.ResourceType == item).FirstOrDefault(); ////Obj_SalaryAndTaxInfo = (from p in t.Tbl_Designations where words.Contains(p.ResourceType) select p).Single(); lblDesignationonpageload.Visible = true; Decimal SalaryPerresource = Convert.ToDecimal(Obj_SalaryAndTaxInfo.SalaryPerResource); SalaryPerDay = (SalaryPerresource / (Convert.ToDecimal(Invoice_Month.NumberofDaysInMonth))); Decimal finalPay = Convert.ToDecimal(Invoice_Month.Total_Days_Worked * SalaryPerDay); txtNumberofResources.Text = Otsi_orders.NumberOfrequiredResources.ToString(); txtProvidedResources.Text = Otsi_orders.ProvidedResources.ToString(); TxtSalary.Text = Obj_SalaryAndTaxInfo.SalaryPerResource.ToString(); LblWorkedDays.Text = Invoice_Month.Total_Days_Worked.ToString(); LblFinalPay.Text = Math.Round(Convert.ToDecimal(finalPay), 0).ToString(); lblDesignation.Text = "Work Order For " + item; Random UniqueNumber = new Random(); //***Taxes forinvoice calculattion // TxtInvoiceNo.Text = "OTSIPL/HMWSSB/" + DLMonth.SelectedValue + "-" + DLYear.SelectedValue + "/" + Convert.ToInt32(UniqueNumber.Next()); TxtPanno.Text = Obj_SalaryAndTaxInfo.PANNO; TxtServiceTaxNo.Text = Obj_SalaryAndTaxInfo.ServiceTAXNO; txtEmployershareEPF.Text = Obj_SalaryAndTaxInfo.EPF; txtEmployershareESI.Text = Obj_SalaryAndTaxInfo.ESI; txtAgencyCommission.Text = Obj_SalaryAndTaxInfo.AgencyComission; txtServiceTAX.Text = Obj_SalaryAndTaxInfo.ServiceTax; TxtSbc.Text = Obj_SalaryAndTaxInfo.SBC; //** Taxes for print **// txtpono.InnerText = ddlWorkOrder.SelectedValue; txtprojectname.InnerText = Otsi_orders.Resources_Type; WoYear.InnerText = DateTime.Now.ToString("yy") + "-" + DateTime.Now.AddYears(1).ToString("yy"); wono.InnerText = ddlWorkOrder.SelectedValue; DesignationType.InnerText = item; getsalaries = GetEmployeMotnhlySalary(SalaryPerDay,item); } Session["PerdaySal"] = SalaryPerDay; InvoiceTable.Visible = true; BtnGenerateInvoice.Visible = true; ddlWorkOrder.Enabled = false; DLMonth.Enabled = false; DLYear.Enabled = false; RetriveInvoice.Visible = false; BtnModifySearch.Visible = true; InVoiceTemplete.Visible = true; InvoiceGridView1.DataSource = getsalaries; InvoiceGridView1.DataBind(); InvoiceGridView1.HeaderRow.TableSection = TableRowSection.TableHeader; InvoiceGridView1.Visible = true; // var Obj_SalaryAndTaxInfo = t.Tbl_Designations.Where(p => words.Contains(p.ResourceType)); // string strResourceType = Obj_SalaryAndTaxInfo.ResourceType // lblDesignationonpageload.Visible = true; //Decimal SalaryPerresource = Convert.ToDecimal(Obj_SalaryAndTaxInfo.SalaryPerResource); //var SalaryPerDay = (SalaryPerresource / (Convert.ToDecimal(Invoice_Month.NumberofDaysInMonth))); //Decimal finalPay = Convert.ToDecimal(Invoice_Month.Total_Days_Worked * SalaryPerDay); //txtNumberofResources.Text = Otsi_orders.NumberOfrequiredResources.ToString(); //txtProvidedResources.Text = Otsi_orders.ProvidedResources.ToString(); //TxtSalary.Text = Obj_SalaryAndTaxInfo.SalaryPerResource.ToString(); //LblWorkedDays.Text = Invoice_Month.Total_Days_Worked.ToString(); //LblFinalPay.Text = Math.Round(Convert.ToDecimal(finalPay), 0).ToString(); //lblDesignation.Text = "Work Order For " + Otsi_orders.Resources_Type; //Random UniqueNumber = new Random(); ////***Taxes forinvoice calculattion //// TxtInvoiceNo.Text = "OTSIPL/HMWSSB/" + DLMonth.SelectedValue + "-" + DLYear.SelectedValue + "/" + Convert.ToInt32(UniqueNumber.Next()); //TxtPanno.Text = Obj_SalaryAndTaxInfo.PANNO; //TxtServiceTaxNo.Text = Obj_SalaryAndTaxInfo.ServiceTAXNO; //txtEmployershareEPF.Text = Obj_SalaryAndTaxInfo.EPF; //txtEmployershareESI.Text = Obj_SalaryAndTaxInfo.ESI; //txtAgencyCommission.Text = Obj_SalaryAndTaxInfo.AgencyComission; //txtServiceTAX.Text = Obj_SalaryAndTaxInfo.ServiceTax; //TxtSbc.Text = Obj_SalaryAndTaxInfo.SBC; ////** Taxes for print **// //txtpono.InnerText = ddlWorkOrder.SelectedValue; //txtprojectname.InnerText = Otsi_orders.Resources_Type; //WoYear.InnerText = DateTime.Now.ToString("yy") + "-" + DateTime.Now.AddYears(1).ToString("yy"); //wono.InnerText = ddlWorkOrder.SelectedValue; //DesignationType.InnerText = Otsi_orders.Resources_Type; //GetEmployeMotnhlySalary(SalaryPerDay); //Session["PerdaySal"] = SalaryPerDay; //InvoiceTable.Visible = true; //BtnGenerateInvoice.Visible = true; //ddlWorkOrder.Enabled = false; //DLMonth.Enabled = false; //DLYear.Enabled = false; //RetriveInvoice.Visible = false; //BtnModifySearch.Visible = true; //InVoiceTemplete.Visible = true; } else { this.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('Timesheet is not Available for this work order on selected month & year')</script>"); txtEmployershareEPF.Text = " "; txtEmployershareESI.Text = " "; txtAgencyCommission.Text = ""; txtServiceTAX.Text = " "; txtNumberofResources.Text = ""; txtProvidedResources.Text = ""; TxtSalary.Text = ""; LblFinalPay.Text = ""; LblWorkedDays.Text = ""; } } catch (Exception ex) { } }
.FirstOrDefault()
null
Obj_SalaryAndTaxInfo
IEnumerable<theType>
foreach
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)