protected void Page_Init(object sender, EventArgs e) { ctx = new AriClinicContext("AriClinicContext"); // security control, it must be a user logged if (Session["User"] == null) { Response.Redirect("Default.aspx"); } else { user = CntAriCli.GetUser((Session["User"] as User).UserId, ctx); Process proc = (from p in ctx.Processes where p.Code == "rtickets" select p).FirstOrDefault <Process>(); per = CntAriCli.GetPermission(user.UserGroup, proc, ctx); } // cheks if is call from another form if (Request.QueryString["Report"] != null) { report = Request.QueryString["Report"]; } if (Request.QueryString["FDate"] != null) { fDate = CntWeb.ParseUrlDate(Request.QueryString["FDate"]); } if (Request.QueryString["TDate"] != null) { tDate = CntWeb.ParseUrlDate(Request.QueryString["TDate"]); } if (Request.QueryString["Diary"] != null) { diary = CntAriCli.GetDiary(int.Parse(Request.QueryString["Diary"]), ctx); } if (Request.QueryString["Visit"] != null) { visit = CntAriCli.GetVisit(int.Parse(Request.QueryString["Visit"]), ctx); } if (Request.QueryString["Treatment"] != null) { treatment = CntAriCli.GetTreatment(int.Parse(Request.QueryString["Treatment"]), ctx); } if (Request.QueryString["Invoice"] != null) { invoice = CntAriCli.GetInvoice(int.Parse(Request.QueryString["Invoice"]), ctx); } if (Request.QueryString["AmendmentInvoice"] != null) { aInvoice = CntAriCli.GetAmendementInvoice(int.Parse(Request.QueryString["AmendmentInvoice"]), ctx); } if (Request.QueryString["PrescriptionGlasses"] != null) { prescriptionGlasses = CntAriCli.GetPrescriptionGlasses(int.Parse(Request.QueryString["PrescriptionGlasses"]), ctx); } if (Request.QueryString["Estimate"] != null) { estimate = CntAriCli.GetEstimate(int.Parse(Request.QueryString["Estimate"]), ctx); } }
protected void LoadData(AmendmentInvoiceLine aInvl) { txtInvoiceLineId.Text = aInvl.AmendmentInvoiceLineId.ToString(); aInv = aInvl.AmendmentInvoice; LoadInvoiceData(); LoadTaxTypeCombo(aInvl.TaxType); txtDescription.Text = aInvl.Description; txtTaxPercentage.Text = String.Format("{0:##0.00}", aInvl.TaxPercentage); txtAmount.Text = String.Format("{0:###,##0.00}", aInvl.Amount); }
protected void Page_Load(object sender, EventArgs e) { // First control the type of parent page if (Request.QueryString["AmendmentInvoiceId"] != null) { aInvoiceId = Int32.Parse(Request.QueryString["AmendmentInvoiceId"]); aInv = CntAriCli.GetAmendementInvoice(aInvoiceId, ctx); caller = "amendmentinvoice"; // Called by Insurance } }
protected void UnloadData(AmendmentInvoice aInv) { aInv.Serial = txtInvoiceSerial.Text; aInv.Year = Int32.Parse(txtYear.Text); if (aInv.InvoiceNumber == 0) { aInv.InvoiceNumber = CntAriCli.GetNextInvoiceNumber(aInv.Serial, aInv.Year, ctx); } aInv.InvoiceDate = (DateTime)rddpInvoiceDate.SelectedDate; customerId = Int32.Parse(txtCustomerId.Text); aInv.Customer = CntAriCli.GetCustomer(customerId, ctx); aInv.Reason = txtReason.Text; aInv.Total = CntAriCli.GetAmendmentInvoiceTotal(aInv); txtInvoiceTotal.Text = String.Format("{0:####,#0.00}", aInv.Total); aInv.InvoiceKey = String.Format("{0}-{1:000000}-{2}", aInv.Year, aInv.InvoiceNumber, aInv.Serial); }
protected void LoadData(AmendmentInvoice aInv) { lblOriginalInvoice.Text = String.Format("Factura original:{0}-{1}-{2} Fecha:{3:dd/MM/yyyy}", aInv.OriginalInvoice.Serial, aInv.OriginalInvoice.Year, aInv.OriginalInvoice.InvoiceNumber, aInv.OriginalInvoice.InvoiceDate); txtInvoiceId.Text = aInv.AmendmentInvoiceId.ToString(); txtInvoiceSerial.Text = aInv.Serial; txtYear.Text = aInv.Year.ToString(); txtInvoiceNumber.Text = String.Format("{0:000000}", aInv.InvoiceNumber); rddpInvoiceDate.SelectedDate = aInv.InvoiceDate; txtCustomerId.Text = aInv.Customer.PersonId.ToString(); txtCustomerName.Text = aInv.Customer.ComercialName; txtReason.Text = aInv.Reason; txtInvoiceTotal.Text = String.Format("{0:####,#0.00}", aInv.Total); }
protected void Page_Init(object sender, EventArgs e) { ctx = new AriClinicContext("AriClinicContext"); // security control, it must be a user logged if (Session["User"] == null) { Response.Redirect("Default.aspx"); } else { user = CntAriCli.GetUser((Session["User"] as User).UserId, ctx); Process proc = (from p in ctx.Processes where p.Code == "invoice" select p).FirstOrDefault <Process>(); per = CntAriCli.GetPermission(user.UserGroup, proc, ctx); btnAccept.Visible = per.Modify; } // if (Request.QueryString["AmendmentInvoiceId"] != null) { aInvoiceId = Int32.Parse(Request.QueryString["AmendmentInvoiceId"]); aInv = CntAriCli.GetAmendementInvoice(aInvoiceId, ctx); LoadInvoiceData(); } else { //TODO: What to do if there is not an invoice } if (Session["Clinic"] != null) { cl = (Clinic)Session["Clinic"]; } // if (Request.QueryString["AmendmentInvoiceLineId"] != null) { aInvoiceLineId = Int32.Parse(Request.QueryString["AmendmentInvoiceLineId"]); aInvl = CntAriCli.GetAmendementInvoiceLine(aInvoiceLineId, ctx); LoadData(aInvl); } else { LoadTaxTypeCombo(null); } }
protected void Page_Init(object sender, EventArgs e) { ctx = new AriClinicContext("AriClinicContext"); // security control, it must be a user logged if (Session["User"] == null) { Response.Redirect("Default.aspx"); } else { user = CntAriCli.GetUser((Session["User"] as User).UserId, ctx); Process proc = (from p in ctx.Processes where p.Code == "amendmentinvoice" select p).FirstOrDefault <Process>(); per = CntAriCli.GetPermission(user.UserGroup, proc, ctx); btnAccept.Visible = per.Modify; } hc = CntAriCli.GetHealthCompany(ctx); // if (Request.QueryString["AmendmentInvoiceId"] != null) { amendmentInvoiceId = Int32.Parse(Request.QueryString["AmendmentInvoiceId"]); aInv = CntAriCli.GetAmendementInvoice(amendmentInvoiceId, ctx); LoadData(aInv); } else { // deafault values rddpInvoiceDate.SelectedDate = DateTime.Now; txtYear.Text = DateTime.Now.Year.ToString(); txtInvoiceSerial.Text = hc.InvoiceSerial; } // if (Request.QueryString["Caller"] != null) { caller = Request.QueryString["Caller"]; } if (Session["Clinic"] != null) { cl = (Clinic)Session["Clinic"]; } // always read Healt care company }
protected bool CreateChange() { if (!DataOk()) { return(false); } // DateTime myDate = (DateTime)rddpInvoiceDate.SelectedDate; string reason = txtReason.Text; // create amendment invoice aInv = CntAriCli.CreateAmendmentInvoice(inv, myDate, reason, ctx); if (aInv == null) { lblMessage.Text = "No se ha podido crear la factura rectificativa, seguramente ya se ha generado otra contra esta factura"; return(false); } return(true); }
protected bool CreateChange() { if (!DataOk()) { return(false); } if (aInv == null) { aInv = new AmendmentInvoice(); UnloadData(aInv); ctx.Add(aInv); } else { aInv = CntAriCli.GetAmendementInvoice(amendmentInvoiceId, ctx); UnloadData(aInv); } ctx.SaveChanges(); return(true); }
protected void RadGrid1_ItemCommand(object sender, Telerik.Web.UI.GridCommandEventArgs e) { // weonly process commands with a datasource (our image buttons) if (e.CommandSource == null) { return; } string typeOfControl = e.CommandSource.GetType().ToString(); if (typeOfControl.Equals("System.Web.UI.WebControls.ImageButton")) { int id = 0; ImageButton imgb = (ImageButton)e.CommandSource; if (imgb.ID != "New" && imgb.ID != "Exit") { id = (int)e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex][e.Item.OwnerTableView.DataKeyNames[0]]; } switch (imgb.ID) { case "Select": break; case "Edit": break; case "Delete": aInv = (from i in ctx.AmendmentInvoices where i.AmendmentInvoiceId == id select i).FirstOrDefault <AmendmentInvoice>(); if (!CntAriCli.DeleteAmendmentInvoice(aInv, ctx)) { lblMessage.Text = Resources.GeneralResource.DeleteInvoiceFailed; return; } lblMessage.Text = ""; ctx.SaveChanges(); RefreshGrid(true); break; } } }