public void UpdateInvoice(string sd) { Invoice inv = new Invoice(); inv.InvoiceId = Int32.Parse(sd.Trim()); inv.GetInvoiceByInvoiceID(); if (inv.Status == LankaTiles.Common.Structures.InvoiceStatus.Created) { inv.Status = Structures.InvoiceStatus.Printed; new InvoiceDAO().UpdateInvoiceStatus(inv); } }
/// <summary> /// This method is used to fill the parameter values /// </summary> /// <param name="invoiceId"></param> public void FillParameters(Int32 invoiceId) { try { this.InvoiceId.Value = invoiceId; DsPrintInvoiceTableAdapters.vw_Invoice_Detail_Sel_ReportTableAdapter tableAdopter = new DsPrintInvoiceTableAdapters.vw_Invoice_Detail_Sel_ReportTableAdapter(); tableAdopter.Fill(this.dsPrintInvoice1.vw_Invoice_Detail_Sel_Report, invoiceId); Invoice invoice = new Invoice(); invoice.InvoiceId = invoiceId; invoice.GetInvoiceByInvoiceID(); this.InvoiceNumber.Value = invoice.InvoiceNo; this.InvDate.Value = invoice.Date.ToShortDateString(); switch (invoice.PaymentType) { case "1": this.PaymentType.Value = "Cash"; break; case "2": this.PaymentType.Value = "Cheque"; break; case "3": this.PaymentType.Value = "Credit Card"; break; default: this.PaymentType.Value = "N/A"; break; } if (invoice.Status != LankaTiles.Common.Structures.InvoiceStatus.Created) { lblDuplicate.Visible = true; } Customer customer = new Customer(); customer.CustomerID = (Int32)invoice.CustomerID; customer.GetCustomerByID(); this.CustomerCode.Value = customer.CustomerCode.Trim(); this.CustomerName.Value = customer.Cus_Name.Trim(); this.GrandTotal.Value = Decimal.Round(invoice.GrandTotal, 2); this.TotalPaid.Value = Decimal.Round(invoice.GrandTotal - invoice.DueAmount, 2); this.DueAmmount.Value = Decimal.Round(invoice.DueAmount, 2); User user = new User(); user.UserId = invoice.CreatedUser; user.GetUserByID(); this.SPName.Value = user.FirstName.Trim(); } catch (Exception ex) { throw ex; } }
protected void ddlInvoiceNumber_SelectedIndexChanged(object sender, EventArgs e) { try { if (ddlInvoiceNumber.SelectedValue == "-1") { return; } else { // // PendingItems // Invoice inv = new Invoice(); inv.InvoiceId = Int32.Parse(ddlInvoiceNumber.SelectedValue.Trim()); DataSet dsItems = (new InvoiceDAO()).GetItemsTobeIssuedByInvoiceID(inv); if (dsItems == null || dsItems.Tables.Count == 0) { ddlItemCode.Items.Add(new ListItem("--No Records--", "-1")); } else { Master.BindDropdown("ItemCode", "Id", dsItems, ddlItemCode); ddlItemCode.Items.Add(new ListItem("--Please Select--", "-1")); ddlItemCode.SelectedValue = "-1"; } inv.GetInvoiceByInvoiceID(); txtInvAmmount.Text = Decimal.Round(inv.GrandTotal, 2).ToString(); } } catch (Exception ex) { ex.Data.Add("UILayerException", this.GetType().ToString() + Constant.Error_Seperator + "protected void ddlInvoiceNumber_SelectedIndexChanged(object sender, EventArgs e)"); if (Master.LoggedUser != null && Master.LoggedUser.UserName != null && Master.LoggedUser.UserName != string.Empty) Response.Redirect("Error.aspx?LogId=" + LankaTilesExceptions.WriteEventLogs(ex, Constant.Database_Connection_Name, Master.LoggedUser.UserName), false); else Response.Redirect("Error.aspx?LogId=" + LankaTilesExceptions.WriteEventLogs(ex, Constant.Database_Connection_Name, "Annonimous"), false); } }