Пример #1
0
        public static decimal GetUnpaid(ServiceNote sn, AriClinicContext ctx)
        {
            decimal amount = sn.Tickets.Sum(t => t.Amount);
            decimal paid   = sn.Tickets.Sum(t => t.Paid);

            return(amount - paid);
        }
Пример #2
0
 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");
 }
Пример #3
0
    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 = (User)Session["User"];
            user = CntAriCli.GetUser(user.UserId, ctx);
            Process proc = (from p in ctx.Processes
                            where p.Code == "visitreason"
                            select p).FirstOrDefault<Process>();
            per = CntAriCli.GetPermission(user.UserGroup, proc, ctx);
            btnAccept.Visible = per.Modify;
        }

        // 
        if (Request.QueryString["VisitReasonId"] != null)
        {
            visitReasonId = Int32.Parse(Request.QueryString["VisitReasonId"]);
            visitReason = CntAriCli.GetVisitReason(visitReasonId, ctx);
            LoadData(visitReason);
        }
    }
Пример #4
0
 public RptPayments(DateTime fDate, DateTime tDate,int clinicId, AriClinicContext ctx)
     : this()
 {
     ctx = new AriClinicContext("AriClinicContext");
     fromDate = fDate; toDate = tDate;
     this.DataSource = CntAriCli.GetPayments(fDate, tDate, clinicId, ctx);
 }
Пример #5
0
        private void iniChart(AriClinicContext ctx1)
        {
            ctx1 = new AriClinicContext("AriClinicContext");
            IList<Professional> prof = CntAriCli.GetProfessionalTickets(fromDate, toDate, ctx1);
            chart1.PlotArea.XAxis.AutoScale = true;
            chart1.PlotArea.XAxis.Items.Clear();
            chart1.AutoLayout = true;
            chart1.ChartTitle.TextBlock.Visible=false;//.Text = "Servicios por profesional.";
            chart1.PlotArea.Appearance.FillStyle.FillType = Telerik.Reporting.Charting.Styles.FillType.Solid;
            chart1.PlotArea.Appearance.FillStyle.MainColor = Color.Transparent;
            ChartSeries chartSeries1 = new ChartSeries();
            chartSeries1.Type = ChartSeriesType.Pie;
            chartSeries1.Appearance.LegendDisplayMode = ChartSeriesLegendDisplayMode.ItemLabels;

            foreach (Professional item in prof)
            {
                ChartSeriesItem serieItem = new ChartSeriesItem();
                serieItem.YValue = (from tic in item.Tickets
                                    where tic.TicketDate >= fromDate && tic.TicketDate <= toDate
                                    select tic).ToList<Ticket>().Count();
                serieItem.Name = item.FullName;
                serieItem.Label.TextBlock.Text = item.Tickets.Count.ToString();
                serieItem.Appearance.Exploded = true;
                chartSeries1.Items.Add(serieItem);
            }

            chart1.Series.Clear();
            chart1.Series.AddRange(new Telerik.Reporting.Charting.ChartSeries[] { chartSeries1 });  
        }
Пример #6
0
        public static void BigDelete(AriClinicContext ctx)
        {
            ctx.Delete(ctx.InvoiceLines);
            ctx.Delete(ctx.Invoices);
            ctx.SaveChanges();
            ctx.Delete(ctx.AppointmentInfos);
            ctx.Delete(ctx.AppointmentTypes);
            ctx.Delete(ctx.Diaries);
            ctx.SaveChanges();

            ctx.Delete(ctx.Payments);
            ctx.Delete(ctx.Tickets);
            ctx.Delete(ctx.ServiceNotes);
            ctx.Delete(ctx.Policies);
            ctx.Delete(ctx.Insurances);
            ctx.Delete(ctx.InsuranceServices);
            ctx.SaveChanges();

            ctx.Delete(ctx.Services);
            ctx.Delete(ctx.ServiceCategories);
            ctx.Delete(ctx.TaxTypes);
            ctx.Delete(ctx.Addresses); // eliminar direcciones.
            ctx.Delete(ctx.Emails); // eliminar correos electrónicos
            ctx.Delete(ctx.Telephones); // eliminar teléfonos.
            ctx.Delete(ctx.Policies); // eliminar las pólizas.
            ctx.Delete(ctx.PaymentMethods);
            ctx.SaveChanges();
        }
Пример #7
0
 public static void DeleteVisit(AriClinicContext ctx)
 {
     ctx.Delete(ctx.OphthalmologicVisits);
     ctx.Delete(ctx.BaseVisits);
     ctx.Delete(ctx.VisitReasons);
     ctx.SaveChanges();
 }
Пример #8
0
 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 == "scat"
                         select p).FirstOrDefault<Process>();
         per = CntAriCli.GetPermission(user.UserGroup, proc, ctx);
     }
     // cheks if is call from another form
     if (Request.QueryString["Type"] != null)
         type = Request.QueryString["Type"];
     // read patient information
     if (Request.QueryString["CustomerId"] != null)
     {
         customerId = Int32.Parse(Request.QueryString["CustomerId"]);
         cus = CntAriCli.GetCustomer(customerId, ctx);
         lblTitle.Text = String.Format("Historial administrativo: {0}", cus.FullName);
         this.Title = String.Format("Historial administrativo: {0}", cus.FullName);
     }
 }
Пример #9
0
    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 == "professional"
                            select p).FirstOrDefault<Process>();
            per = CntAriCli.GetPermission(user.UserGroup, proc, ctx);
            btnAccept.Visible = per.Modify;
        }

        // 
        if (Request.QueryString["ProfessionalId"] != null)
        {
            professionalId = Int32.Parse(Request.QueryString["ProfessionalId"]);
            prof = CntAriCli.GetProfessional(professionalId, ctx);
            LoadData(prof);
        }
        else
        {
            LoadUserCombo(null);
            LoadTypeCombo(null);
            LoadTaxWithholdingTypeCombo(null);
        }

    }
Пример #10
0
 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 == "scat"
                         select p).FirstOrDefault<Process>();
         per = CntAriCli.GetPermission(user.UserGroup, proc, ctx);
     }
     //cheks if is call from customer form tabs
     if (type == "InTab")
     {
         HtmlControl tt = (HtmlControl)this.FindControl("TitleArea");
         tt.Attributes["class"] = "ghost";
         // hide patient column
         RadGrid1.Columns.FindByDataField("Patient.FullName").Visible = false;
     }
     // cheks if is call from another form
     if (Request.QueryString["Type"] != null)
         type = Request.QueryString["Type"];
     // translate filters
     CntWeb.TranslateRadGridFilters(RadGrid1);
 }
Пример #11
0
 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 == "policy"
                         select p).FirstOrDefault<Process>();
         per = CntAriCli.GetPermission(user.UserGroup, proc, ctx);
         btnAccept.Visible = per.Modify;
     }
     // 
     if (Request.QueryString["CustomerId"] != null)
     {
         patientId = Int32.Parse(Request.QueryString["CustomerId"]);
         pat = CntAriCli.GetCustomer(patientId, ctx);
         txtCustomer.Text = pat.FullName;
     }
     // 
     if (Request.QueryString["PolicyId"] != null)
     {
         policyId = Int32.Parse(Request.QueryString["PolicyId"]);
         pol = CntAriCli.GetPolicy(policyId, ctx);
         LoadData(pol);
     }
     else
     {
         LoadTypeCombo(null);
         LoadInsuranceCombo(null);
     }
 }
Пример #12
0
 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["PrescriptionGlasses"] != null)
         prescriptionGlasses = CntAriCli.GetPrescriptionGlasses(int.Parse(Request.QueryString["PrescriptionGlasses"]), ctx);
 }
Пример #13
0
    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 == "usergroup"
                            select p).FirstOrDefault<Process>();
            per = CntAriCli.GetPermission(user.UserGroup, proc, ctx);
            btnAccept.Visible = per.Modify;
        }

        // 
        if (Request.QueryString["UserGroupId"] != null)
        {
            userGroupId = Int32.Parse(Request.QueryString["UserGroupId"]);
            UserGroup ug = (from usg in ctx.UserGroups
                            where usg.UserGroupId == userGroupId
                            select usg).FirstOrDefault<UserGroup>();
            LoadData(ug);
        }
    }
    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 == "servicesubcategory"
                            select p).FirstOrDefault<Process>();
            per = CntAriCli.GetPermission(user.UserGroup, proc, ctx);
            btnAccept.Visible = per.Modify;
        }

        // 
        if (Request.QueryString["ServiceSubCategoryId"] != null)
        {
            serviceSubCategoryId = Int32.Parse(Request.QueryString["ServiceSubCategoryId"]);
            serSub = CntAriCli.GetServiceSubcategory(serviceSubCategoryId, ctx);
            LoadData(serSub);
        }
        else
        {
            LoadServiceCategory(null);
        }
    }
Пример #15
0
 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 == "user"
                         select p).FirstOrDefault<Process>();
         per = CntAriCli.GetPermission(user.UserGroup, proc, ctx);
         btnAccept.Visible = per.Modify;
         // special for this form
         ddlGroup.Enabled = per.Create;
     }
     // 
     if (Request.QueryString["UserId"] != null)
     {
         userId = Int32.Parse(Request.QueryString["UserId"]);
         User usr = (from u in ctx.Users
                     where u.UserId == userId
                     select u).FirstOrDefault<User>();
         LoadData(usr);
     }
     else
     {
         LoadGroupCombo(null);
         LoadBaseVisitType(null);
         LoadClinic(null);
     }
 }
Пример #16
0
 public RptTicket(int idticket, AriClinicContext ctx1)
     : this()
 {
     ctx1 = new AriClinicContext("AriClinicContext");
     companyname = CntAriCli.GetHealthCompany(ctx1).Name;
     this.DataSource = CntAriCli.GetTicket(idticket, ctx1);
 }
Пример #17
0
 public RptTicketsNoPaid(DateTime fDate, DateTime tDate,int insuranceId, AriClinicContext ctx)
     : this()
 {
     ctx = new AriClinicContext("AriClinicContext");
     fromDate = fDate; toDate = tDate;
     this.DataSource = CntAriCli.GetTickets(fDate, tDate, insuranceId, "NP", ctx);
 }
Пример #18
0
    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 = (User)Session["User"];
            user = CntAriCli.GetUser(user.UserId, ctx);
            Process proc = (from p in ctx.Processes
                            where p.Code == "examinationassigned"
                            select p).FirstOrDefault<Process>();
            per = CntAriCli.GetPermission(user.UserGroup, proc, ctx);
            btnAccept.Visible = per.Modify;
        }

        // 
        if (Request.QueryString["GlassesTestId"] != null)
        {
            id = Int32.Parse(Request.QueryString["GlassesTestId"]);
            glassesTest = CntAriCli.GetGlassesTest(id, ctx);
            refractometry = glassesTest.Refractometry;
            LoadData(glassesTest);
        }
        if (Request.QueryString["RefractometryId"] != null)
        {
            id = int.Parse(Request.QueryString["RefractometryId"]);
            refractometry = (Refractometry)CntAriCli.GetExaminationAssigned(id, ctx);
        }
    }
Пример #19
0
        private void iniChart(AriClinicContext ctx1)
        {
            ctx1 = new AriClinicContext("AriClinicContext");
            IList<Professional> prof = CntAriCli.GetSurgeonTickets(fromDate, toDate, ctx1);
            chart1.PlotArea.XAxis.AutoScale = true;
            chart1.PlotArea.XAxis.Items.Clear();
            chart1.AutoLayout = true;
            chart1.ChartTitle.TextBlock.Visible=false;//.Text = "Servicios por profesional.";
            chart1.PlotArea.Appearance.FillStyle.FillType = Telerik.Reporting.Charting.Styles.FillType.Solid;
            chart1.PlotArea.Appearance.FillStyle.MainColor = Color.Transparent;
            ChartSeries chartSeries1 = new ChartSeries();
            chartSeries1.Type = ChartSeriesType.Pie;
            chartSeries1.Appearance.LegendDisplayMode = ChartSeriesLegendDisplayMode.ItemLabels;

            foreach (Professional item in prof)
            {
                ChartSeriesItem serieItem = new ChartSeriesItem();
                int num = CntAriCli.GetTicketsByCirujano(fromDate, toDate, item.PersonId.ToString(), ctx1).Count;
                if (num > 0)
                {
                    serieItem.YValue = num;
                    serieItem.Name = item.FullName;
                    serieItem.Label.TextBlock.Text = num.ToString();
                    serieItem.Appearance.Exploded = true;
                    chartSeries1.Items.Add(serieItem);
                }
            }

            chart1.Series.Clear();
            chart1.Series.AddRange(new Telerik.Reporting.Charting.ChartSeries[] { chartSeries1 });  
        }
Пример #20
0
 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 == "Estimate"
                         select p).FirstOrDefault<Process>();
         per = CntAriCli.GetPermission(user.UserGroup, proc, ctx);
         btnAccept.Visible = per.Modify;
     }
     //
     LoadComboInsurance();
     // 
     if (Request.QueryString["EstimateId"] != null)
     {
         estId = Int32.Parse(Request.QueryString["EstimateId"]);
         est = CntAriCli.GetEstimate(estId, ctx);
         
     }
     // 
     if (Request.QueryString["EstimateLineId"] != null)
     {
         estlId = Int32.Parse(Request.QueryString["EstimateLineId"]);
         estl = CntAriCli.GetEstimateLine(estlId, ctx);
         LoadData(estl);
     }
 }
Пример #21
0
    protected void Page_Init(object sender, EventArgs e)
    {
        ctx = new AriClinicContext("AriClinicContext");
        // security control, This is a general view accesible for all

        // Do you want to see a Diary?
        if (Request.QueryString["DiaryId"] != null)
        {
            diaryId = int.Parse(Request.QueryString["DiaryId"]);
            diary = CntAriCli.GetDiary(diaryId, ctx);
            if (diary != null)
            {
                lblTitle.Text = diary.Name;
                this.Title = diary.Name;
            }
        }
        else
        {
            // this view is only for specific agendas
            Response.Redirect("Default.aspx");
        }
        // Do you want to see a Professional?
        if (Request.QueryString["ProfessionalId"] != null)
        {
            professionalId = int.Parse(Request.QueryString["ProfessionalId"]);
            professional = CntAriCli.GetProfessional(professionalId, ctx);
            if (professional != null)
                lblTitle.Text = professional.FullName;
        }
    }
Пример #22
0
 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 == "policy"
                         select p).FirstOrDefault<Process>();
         per = CntAriCli.GetPermission(user.UserGroup, proc, ctx);
     }
     // cheks if is call from another form
     if (Request.QueryString["Type"] != null)
         type = Request.QueryString["Type"];
     // read the realated patient
     if (Request.QueryString["PatientId"] != null)
     {
         patientId = Int32.Parse(Request.QueryString["PatientId"]);
         pat = CntAriCli.GetPatient(patientId, ctx);
         cus = pat.Customer;
     }
     if (Request.QueryString["CustomerId"] != null)
     {
         customerId = Int32.Parse(Request.QueryString["CustomerId"]);
         cus = CntAriCli.GetCustomer(customerId, ctx);
     }
     // translate filters
     CntWeb.TranslateRadGridFilters(RadGrid1);
 }
Пример #23
0
    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 == "request"
                            select p).FirstOrDefault<Process>();
            per = CntAriCli.GetPermission(user.UserGroup, proc, ctx);
            btnAccept.Visible = per.Modify;
        }
        //
        if (Request.QueryString["RequestId"] != null)
        {
            requestId = Int32.Parse(Request.QueryString["RequestId"]);
            request = CntAriCli.GetRequest(requestId, ctx);
            if (request != null)
            {
                string person = "";
                if (request.Patient != null) 
                    person = request.Patient.FullName;
                else 
                    person = request.FullName;
                lblRequestPerson.Text = String.Format("INTERESADO: {0}", person);
                string service = "";
                if (request.Service != null)
                {
                    service = request.Service.Name;
                    rdcService.Items.Clear();
                    rdcService.Items.Add(new RadComboBoxItem(request.Service.Name,request.Service.ServiceId.ToString()));
                    rdcService.SelectedValue = request.Service.ServiceId.ToString();
                }
                lblRequestService.Text = String.Format("SERVICIO: {0}", service);
                lblRequestComments.Text = String.Format("OBSERVACIONES: {0}", request.Comments);
            }
        }

        // 
        if (Request.QueryString["ReplayId"] != null)
        {
            replayId = Int32.Parse(Request.QueryString["ReplayId"]);
            replay = CntAriCli.GetReplay(replayId, ctx);
            LoadData(replay);
        }
        else
        {
            // default values for a new request
            rdtReplayDate.SelectedDate = DateTime.Now;
        }
        //
        if (Request.QueryString["Caller"] != null)
        {
            caller = Request.QueryString["Caller"];
        }
    }
Пример #24
0
 public RptServCategory(DateTime fDate, DateTime tDate, AriClinicContext ctx1)
     : this()
 {
     ctx1 = new AriClinicContext("AriClinicContext");
     fromDate = fDate; toDate = tDate;
     companyname= CntAriCli.GetHealthCompany(ctx1).Name;
     this.DataSource = CntAriCli.GetTickets(fromDate, toDate, ctx1); 
 }
Пример #25
0
 public RptNomenclator(AriClinicContext ctx1)
     : this()
 {
     ctx1 = new AriClinicContext("AriClinicContext");
     companyname = CntAriCli.GetHealthCompany(ctx1).Name;
     IList<Procedure> listProc = (from p in ctx1.Procedures select p).ToList<Procedure>();
     this.DataSource = listProc;
 }
Пример #26
0
 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 == "policy"
                         select p).FirstOrDefault<Process>();
         per = CntAriCli.GetPermission(user.UserGroup, proc, ctx);
     }
     // cheks if is call from another form
     if (Request.QueryString["Type"] != null)
         type = Request.QueryString["Type"];
     // read the realated patient
     if (Request.QueryString["PatientId"] != null)
     {
         patientId = Int32.Parse(Request.QueryString["PatientId"]);
         pat = CntAriCli.GetPatient(patientId, ctx);
         cus = pat.Customer;
     }
     // read passed customer if any
     if (Request.QueryString["CustomerId"] != null)
     {
         customerId = Int32.Parse(Request.QueryString["CustomerId"]);
         cus = CntAriCli.GetCustomer(customerId, ctx);
     }
     // 
     if (type == "InTab")
     {
         HtmlControl tt = (HtmlControl)this.FindControl("TitleArea");
         tt.Attributes["class"] = "ghost";
         // hide patient column
         RadGrid1.Columns.FindByDataField("Ticket.Policy.Customer.FullName").Visible = false;
     }
     if (Request.QueryString["ServiceNoteId"] != null)
     {
         serviceNoteId = int.Parse(Request.QueryString["ServiceNoteId"]);
         serviceNote = CntAriCli.GetServiceNote(serviceNoteId, ctx);
         HtmlControl tt = (HtmlControl)this.FindControl("TitleArea");
         tt.Attributes["class"] = "ghost";
         RadGrid1.Columns.FindByDataField("ServiceNote.Customer.FullName").Visible = false;
         // Ticket.Description
         RadGrid1.Columns.FindByDataField("Ticket.Description").Visible = false;
         // Ticket.Amount
         RadGrid1.Columns.FindByDataField("Ticket.Amount").Visible = false;
         //Ticket.Paid
         RadGrid1.Columns.FindByDataField("Ticket.Paid").Visible = false;
         // to fit in iframe space
         RadGrid1.PageSize = 3;
         RadGrid1.AllowFilteringByColumn = false;
     }
     // translate filters
     CntWeb.TranslateRadGridFilters(RadGrid1);
 }
Пример #27
0
 public static void GeneralPaymentDelete(GeneralPayment gp, AriClinicContext ctx)
 {
     foreach (Payment p in gp.Payments)
     {
         PaymentDelete(p, ctx);
     }
     ctx.Delete(gp);
     ctx.SaveChanges();
 }
Пример #28
0
 public static void GeneralPaymentDelete(GeneralPayment gp, AriClinicContext ctx)
 {
     foreach (Payment p in gp.Payments)
     {
         PaymentDelete(p, ctx);
     }
     ctx.Delete(gp);
     ctx.SaveChanges();
 }
    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 == "ticket"
                            select p).FirstOrDefault<Process>();
            per = CntAriCli.GetPermission(user.UserGroup, proc, ctx);
            btnAccept.Visible = per.Modify;
        }

       
            if (Request.QueryString["CustomerId"] != null)
            {
                customerId = Int32.Parse(Request.QueryString["CustomerId"]);
                cus = CntAriCli.GetCustomer(customerId, ctx);
                //txtCustomerId.Text = cus.PersonId.ToString();

                rdcComercialName.Items.Clear();
                rdcComercialName.Items.Add(new RadComboBoxItem(cus.FullName, cus.PersonId.ToString()));
                rdcComercialName.SelectedValue = cus.PersonId.ToString();
                rdcComercialName.Enabled = false;

                btnCustomerId.Visible = false;
            }
            else
            {
                LoadClinicCombo(null);
            }
            if (Session["Clinic"] != null)
                cl = (Clinic)Session["Clinic"];
            // 
            if (Request.QueryString["AnestheticServiceNoteId"] != null)
            {
                anestheticServiceNoteId = Int32.Parse(Request.QueryString["AnestheticServiceNoteId"]);
                asn = CntAriCli.GetAnestheticServiceNote(anestheticServiceNoteId, ctx);
                cus = asn.Customer;
                customerId = cus.PersonId;
                if(!IsPostBack)
                    LoadData(asn);
                // Load internal frame
                HtmlControl frm = (HtmlControl)this.FindControl("ifTickets");
                frm.Attributes["src"] = String.Format("TicketGrid.aspx?AnestheticServiceNoteId={0}", anestheticServiceNoteId);
            }
            else
            {
                // If there isn't a ticket the default date must be today
                rddpServiceNoteDate.SelectedDate = DateTime.Now;
                LoadClinicCombo(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 = (User)Session["User"];
            user = CntAriCli.GetUser(user.UserId, ctx);
            Process proc = (from p in ctx.Processes
                            where p.Code == "procedureassigned"
                            select p).FirstOrDefault<Process>();
            per = CntAriCli.GetPermission(user.UserGroup, proc, ctx);
            btnAccept.Visible = per.Modify;
        }

        // 
        if (Request.QueryString["ProcedureAssignedId"] != null)
        {
            procedureAssignedId = Int32.Parse(Request.QueryString["ProcedureAssignedId"]);
            procedureAssigned = CntAriCli.GetProcedureAssigned(procedureAssignedId, ctx);
            LoadData(procedureAssigned);
        }
        else
        {
            rdpProcedureDate.SelectedDate = DateTime.Now;
        }
        //
        if (Request.QueryString["PatientId"] != null)
        {
            patientId = int.Parse(Request.QueryString["PatientId"]);
            patient = CntAriCli.GetPatient(patientId, ctx);
            // fix rdc with patient
            rdcPatient.Items.Clear();
            rdcPatient.Items.Add(new RadComboBoxItem(patient.FullName,patient.PersonId.ToString()));
            rdcPatient.SelectedValue = patient.PersonId.ToString();
            rdcPatient.Enabled = false;
        }
        //
        if (Request.QueryString["VisitId"] != null)
        {
            visitId = int.Parse(Request.QueryString["VisitId"]);
            visit = CntAriCli.GetVisit(visitId, ctx);
            patientId = visit.Patient.PersonId;
            patient = CntAriCli.GetPatient(patientId, ctx);
            // fix rdc with patient
            rdcPatient.Items.Clear();
            rdcPatient.Items.Add(new RadComboBoxItem(patient.FullName, patient.PersonId.ToString()));
            rdcPatient.SelectedValue = patient.PersonId.ToString();
            rdcPatient.Enabled = false;
            //
            rdpProcedureDate.SelectedDate = visit.VisitDate;
        }

    }
 public static decimal GetInvoiceAmount(int invoiceId)
 {
     decimal total = 0;
     using (AriClinicContext ctx = new AriClinicContext("AriClinicContext"))
     {
         ProfessionalInvoice pInvoice = CntAriCli.GetProfessionalInvoice(invoiceId, ctx);
         if (pInvoice != null) total = pInvoice.Amount;
     }
     return total;
 }
Пример #32
0
 public static void PaymentDelete(Payment pay, AriClinicContext ctx)
 {
     // minus paid in ticket
     if (pay.Ticket != null)
     {
         pay.Ticket.Paid = pay.Ticket.Paid - pay.Amount;
     }
     ctx.Delete(pay);
     ctx.SaveChanges();
 }
Пример #33
0
         public RptPatientDebt(AriClinicContext ctx1)
            : this()
        {
            ctx1 = new AriClinicContext("AriClinicContext");
            companyname = CntAriCli.GetHealthCompany(ctx1).Name;
            IList<Ticket> tickets = CntAriCli.GetTickets(true,ctx1);//.GetInvoicesByCustomer(ffin, idCustomer, ctx1);
            this.DataSource = tickets;
            //this.subReport2.ReportSource.DataSource = GetInvoideLines(invoices);

        }
Пример #34
0
 public static void ApplyRisk(AnestheticServiceNote asn, AriClinicContext ctx)
 {
     if (asn.Chk3)
     {
         foreach (AnestheticTicket atck in asn.AnestheticTickets)
         {
             atck.Amount = atck.Amount * 1.5M;
         }
         ctx.SaveChanges();
     }
 }
Пример #35
0
        public static void ApplyPCA(AnestheticServiceNote asn, AriClinicContext ctx)
        {
            // Read parameters
            AriCliModel.Parameter parameter = GetParameter(ctx);
            Service painPump = parameter.PainPump;

            // Do we need check pain pump?
            if (painPump != null && asn.Chk1)
            {
                // Is there a pain pump assigned?
                var rs = from t in asn.AnestheticTickets
                         where t.InsuranceService.Service.ServiceId == painPump.ServiceId
                         select t;
                if (rs.Count() == 0)
                {
                    // Does this customer have a primary policy with that service?
                    Policy pol = PrimaryPolicy(asn.Customer);
                    if (pol == null)
                    {
                        throw new AriCliException(1, "There isn't a primary policy for this customer");
                    }
                    // Does this policy (insurance) includes a pain pump service?
                    InsuranceService ins = PolicyIncludesService(pol, painPump);
                    if (ins == null)
                    {
                        throw new AriCliException(2, "The insurance company have not the pain pump service assigned");
                    }
                    // More expensive procedure
                    AnestheticTicket aatck = asn.AnestheticTickets.OrderByDescending(x => x.Amount).FirstOrDefault <AnestheticTicket>();
                    if (aatck != null)
                    {
                        Procedure proc = aatck.Procedure;
                        // Everything seems ok, we can add the ticket
                        AnestheticTicket atck = new AnestheticTicket()
                        {
                            TicketDate            = asn.ServiceNoteDate,
                            Description           = String.Format("{0} ({1})", proc.Name, ins.Service.Name),
                            Amount                = ins.Price,
                            Policy                = pol,
                            InsuranceService      = ins,
                            User                  = asn.User,
                            Clinic                = asn.Clinic,
                            Professional          = asn.Professional,
                            Surgeon               = asn.Surgeon,
                            Procedure             = proc,
                            AnestheticServiceNote = asn
                        };
                        ctx.Add(atck);
                        ctx.SaveChanges();
                    }
                }
            }
        }
Пример #36
0
        public static void ApplyMultiTicket(AnestheticServiceNote asn, AriClinicContext ctx)
        {
            bool first = true;

            if (asn.AnestheticTickets.Count > 1)
            {
                foreach (AnestheticTicket atck in asn.AnestheticTickets.OrderByDescending(x => x.Amount))
                {
                    if (!first)
                    {
                        atck.Amount   = atck.Amount / 2;
                        atck.Comments = "-50%";
                        ctx.SaveChanges();
                    }
                    first = false;
                }
            }
        }
Пример #37
0
        public static void CheckTickets(AnestheticServiceNote asn, bool[] lschk, AriClinicContext ctx)
        {
            int i      = 0;
            int lenght = lschk.Count();

            foreach (AnestheticTicket actk in asn.AnestheticTickets)
            {
                if (asn.Chk2)
                {
                    actk.Checked = true;
                }
                else
                {
                    if (i < lenght)
                    {
                        actk.Checked = lschk[i];
                    }
                }
                i++;
            }
            ctx.SaveChanges();
        }
Пример #38
0
        public static void CreateAssociateTickets(AnestheticServiceNote asn, AriClinicContext ctx)
        {
            // Does this customer have a primary policy with that service?
            Policy pol = PrimaryPolicy(asn.Customer);

            if (pol == null)
            {
                throw new AriCliException(1, "There isn't a primary policy for this customer");
            }
            // Delete all tickets
            ctx.Delete(asn.AnestheticTickets);
            foreach (Procedure proc in asn.Procedures)
            {
                // Does this policy includes related (from procedure) services
                InsuranceService ins = PolicyIncludesService(pol, proc.Service);
                if (ins == null)
                {
                    throw new AriCliException(3, "The insurance company have not the nomenclator service assigned");
                }
                // Everything seems ok, we can add anesthetic ticket
                AnestheticTicket atck = new AnestheticTicket()
                {
                    TicketDate            = asn.ServiceNoteDate,
                    Description           = String.Format("{0} ({1})", proc.Name, ins.Service.Name),
                    Amount                = ins.Price,
                    Policy                = pol,
                    InsuranceService      = ins,
                    User                  = asn.User,
                    Clinic                = asn.Clinic,
                    Professional          = asn.Professional,
                    Surgeon               = asn.Surgeon,
                    Procedure             = proc,
                    AnestheticServiceNote = asn
                };
                ctx.Add(atck);
                ctx.SaveChanges();
            }
        }
Пример #39
0
        public static GeneralPayment GeneralPaymentNew(Clinic clinic, ServiceNote sn, decimal amount, PaymentMethod payMethod, DateTime payDate, string description, AriClinicContext ctx)
        {
            var rs = from t in sn.Tickets
                     where t.Amount > t.Paid
                     select t;
            GeneralPayment gp = new GeneralPayment();

            gp.ServiceNote   = sn;
            gp.PaymentDate   = payDate;
            gp.Description   = description;
            gp.PaymentMethod = payMethod;
            gp.Amount        = amount;
            gp.Clinic        = clinic;
            ctx.Add(gp);
            foreach (Ticket t in rs.OrderByDescending(tk => tk.Amount - tk.Paid))
            {
                Payment pay = new Payment();
                pay.PaymentMethod  = payMethod;
                pay.PaymentDate    = payDate;
                pay.Ticket         = t;
                pay.GeneralPayment = gp;
                pay.Description    = description;
                pay.Clinic         = clinic;
                decimal dif = t.Amount - t.Paid;
                if (dif <= amount)
                {
                    pay.Amount = dif;
                    amount     = amount - dif;
                    t.Paid     = t.Paid + dif;
                }
                else
                {
                    pay.Amount = amount;
                    t.Paid     = t.Paid + amount;
                    amount     = 0;
                }
                ctx.Add(pay);
                if (amount == 0)
                {
                    break;
                }
            }
            ctx.SaveChanges();
            return(gp);
        }
Пример #40
0
        public static bool UpdateRelatedTckV2(AnestheticServiceNote asn, bool[] lschk, AriClinicContext ctx)
        {
            bool res = true;

            try
            {
                CreateAssociateTickets(asn, ctx);
                ApplyMultiTicket(asn, ctx);
                ApplyPCA(asn, ctx);
                ApplyRisk(asn, ctx);
                CheckTickets(asn, lschk, ctx);
            }
            catch (AriCliException ex)
            {
                res = false;
            }
            return(res);
        }