Exemplo n.º 1
0
    /// <summary>
    /// 合同管理
    /// </summary>
    private void BindHT()
    {
        string  strsql2 = "select top 8 * from tunnel_index where typeid=161 and del=0 and IsDel=0 order by setdate desc";
        DataSet das2    = Tunnel.Data.DbHelperSQL.Query(strsql2);

        Repeater18.DataSource = das2;
        Repeater18.DataBind();
    }
Exemplo n.º 2
0
    protected void FillInvoicesList(DataTable dt_invoices)
    {
        Invoice[] invoices   = new Invoice[dt_invoices.Rows.Count];
        int[]     invoiceIDs = new int[dt_invoices.Rows.Count];


        int countShowing = 0;

        dt_invoices.Columns.Add("message_reversed_wiped", typeof(string));
        dt_invoices.Columns.Add("td_name", typeof(string));                // for use of td 'name' tag to hide all reversed or hide all rejected
        dt_invoices.Columns.Add("style_display", typeof(string));          // to set initially reversed and/or rejected as hidden
        dt_invoices.Columns.Add("inv_debtor", typeof(string));
        dt_invoices.Columns.Add("inv_total_due", typeof(decimal));
        for (int i = 0; i < dt_invoices.Rows.Count; i++)
        {
            Invoice invoice = InvoiceDB.LoadAll(dt_invoices.Rows[i]);

            invoiceIDs[i] = invoice.InvoiceID;
            invoices[i]   = invoice;

            if (invoice.ReversedBy != null)
            {
                dt_invoices.Rows[i]["message_reversed_wiped"] = "Reversed";
                dt_invoices.Rows[i]["td_name"]       = "td_reversed";
                dt_invoices.Rows[i]["style_display"] = "none";
            }
            else if (invoice.PayerOrganisation != null && (invoice.PayerOrganisation.OrganisationID == -1 || invoice.PayerOrganisation.OrganisationID == -2) && invoice.Total > 0 && invoice.CreditNotesTotal >= invoice.Total)
            {
                dt_invoices.Rows[i]["message_reversed_wiped"] = "Rejected";
                dt_invoices.Rows[i]["td_name"]       = "td_rejected";
                dt_invoices.Rows[i]["style_display"] = "none";
            }
            else
            {
                countShowing++;
            }

            if (invoice.PayerOrganisation != null)
            {
                dt_invoices.Rows[i]["inv_debtor"] = invoice.PayerOrganisation.Name;
            }
            else if (invoice.PayerPatient != null)
            {
                dt_invoices.Rows[i]["inv_debtor"] = invoice.PayerPatient.Person.FullnameWithoutMiddlename;
            }
            else
            {
                dt_invoices.Rows[i]["inv_debtor"] = invoice.Booking != null &&
                                                    invoice.Booking.Patient != null &&
                                                    invoice.Booking.Patient.Person != null    ? invoice.Booking.Patient.Person.FullnameWithoutMiddlename : string.Empty; // empty for invoices without bookings
            }
            dt_invoices.Rows[i]["inv_total_due"] = invoice.TotalDue.ToString();
        }


        // single db call to get invoicelines into hashtable lookup by invoice
        Hashtable invoiceLinesHash = InvoiceLineDB.GetBulkInvoiceLinesByInvoiceID(invoices);

        dt_invoices.Columns.Add("inv_lines_text", typeof(string));
        for (int i = 0; i < dt_invoices.Rows.Count; i++)
        {
            Invoice       invoice  = InvoiceDB.LoadAll(dt_invoices.Rows[i]);
            InvoiceLine[] invLines = (InvoiceLine[])invoiceLinesHash[invoice.InvoiceID];

            bool showAreaTreated      = invoice.PayerOrganisation != null && (invoice.PayerOrganisation.OrganisationID == -2 || invoice.PayerOrganisation.OrganisationType.OrganisationTypeID == 150);
            bool showServiceReference = invoice.PayerOrganisation != null && invoice.PayerOrganisation.OrganisationType.OrganisationTypeID == 150;

            string output = "<ul style=\"padding-left:14px;\">";
            foreach (InvoiceLine invLine in invLines)
            {
                string extras = string.Empty;
                if (showAreaTreated || showServiceReference)
                {
                    string linkAreaTreated      = "<a title=\"Edit\" onclick=\"javascript:window.showModalDialog('Invoice_UpdateAreaTreatedV2.aspx?inv_line=" + invLine.InvoiceLineID + "', '', 'dialogWidth:600px;dialogHeight:275px;center:yes;resizable:no; scroll:no');window.location.href=window.location.href;return false;\" href=\"#\">Edit</a>";
                    string linkServiceReference = "<a title=\"Edit\" onclick=\"javascript:window.showModalDialog('Invoice_UpdateServiceReferenceV2.aspx?inv_line=" + invLine.InvoiceLineID + "', '', 'dialogWidth:600px;dialogHeight:275px;center:yes;resizable:no; scroll:no');window.location.href=window.location.href;return false;\" href=\"#\">Edit</a>";

                    extras += "<table>";
                    if (showAreaTreated)
                    {
                        extras += "<tr><td>Area Treated</td><td style=\"min-width:10px;\"></td><td>" + (invLine.AreaTreated.Length == 0 ? "[EMPTY]" : invLine.AreaTreated) + "</td><td style=\"min-width:10px;\"></td><td>" + linkAreaTreated + "</td></tr>";
                    }
                    if (showServiceReference)
                    {
                        extras += "<tr><td>Service Reference</td><td style=\"min-width:10px;\"></td><td>" + (invLine.ServiceReference.Length == 0 ? "[EMPTY]" : invLine.ServiceReference) + "</td><td style=\"min-width:10px;\"></td><td>" + linkServiceReference + "</td></tr>";
                    }
                    extras += "</table>";
                }

                string itemDescr = string.Empty;
                if (invLine.Offering != null)
                {
                    itemDescr = invLine.Offering.Name;
                }
                if (invLine.Credit != null)
                {
                    itemDescr = "Voucher: <i>" + invLine.Credit.VoucherDescr + "</i>";
                }


                output += "<li>" + itemDescr + " x " + ((invLine.Quantity % 1) == 0 ? Convert.ToInt32(invLine.Quantity) : invLine.Quantity) + " = " + invLine.Price + (invLine.Tax == 0 ? "" : " (<i>Inc GST</i>)") + (invLine.Patient.Person == null ? "" : " [" + invLine.Patient.Person.FullnameWithoutMiddlename + "]") + extras + "</li>";
            }
            output += "</ul>";

            dt_invoices.Rows[i]["inv_lines_text"] = output;

            if (countShowing == 0)
            {
                dt_invoices.Rows[i]["style_display"] = "";
            }
        }


        //get approximate page width...
        // 194 = row titles
        // average row = 340 px (about 220-440)
        // add 70px for good measure
        int pageWidth = 194 + 365 * (countShowing == 0 ? 1 : countShowing) + 120;

        Page.ClientScript.RegisterStartupScript(this.GetType(), "resize_window", "<script language=javascript>window.resizeTo(  (" + pageWidth + "+ window.outerWidth - window.innerWidth) < screen.width ? (" + pageWidth + " + window.outerWidth - window.innerWidth) : screen.width , window.outerHeight);</script>");



        if (dt_invoices.Rows.Count <= 1)
        {
            divToggleShowReversedRejected.Visible = false;
        }
        else if (countShowing == 0)
        {
            chkShowReversed.Checked = true;
            chkShowRejected.Checked = true;
        }


        // now databind
        Repeater1.DataSource  = dt_invoices; Repeater1.DataBind();
        Repeater2.DataSource  = dt_invoices; Repeater2.DataBind();
        Repeater3.DataSource  = dt_invoices; Repeater3.DataBind();
        Repeater4.DataSource  = dt_invoices; Repeater4.DataBind();
        Repeater5.DataSource  = dt_invoices; Repeater5.DataBind();
        Repeater6.DataSource  = dt_invoices; Repeater6.DataBind();
        Repeater7.DataSource  = dt_invoices; Repeater7.DataBind();
        Repeater8.DataSource  = dt_invoices; Repeater8.DataBind();
        Repeater9.DataSource  = dt_invoices; Repeater9.DataBind();
        Repeater10.DataSource = dt_invoices; Repeater10.DataBind();
        Repeater11.DataSource = dt_invoices; Repeater11.DataBind();
        Repeater12.DataSource = dt_invoices; Repeater12.DataBind();
        Repeater13.DataSource = dt_invoices; Repeater13.DataBind();
        Repeater14.DataSource = dt_invoices; Repeater14.DataBind();
        Repeater15.DataSource = dt_invoices; Repeater15.DataBind();
        Repeater16.DataSource = dt_invoices; Repeater16.DataBind();
        Repeater17.DataSource = dt_invoices; Repeater17.DataBind();
        Repeater18.DataSource = dt_invoices; Repeater18.DataBind();
        Repeater19.DataSource = dt_invoices; Repeater19.DataBind();


        // non booking invoices (ie standard invoices) will not have a booking
        Booking booking = invoices[0].Booking;

        if (booking != null)
        {
            string patientText = string.Empty;
            if (booking != null && booking.Patient != null)
            {
                patientText = booking.Patient.Person.FullnameWithoutMiddlename;
            }
            else if (invoices[0].PayerPatient != null)
            {
                patientText = invoices[0].PayerPatient.Person.FullnameWithoutMiddlename;
            }
            else
            {
                patientText = "< No patient >";
            }


            // show booking info
            lblBooking_Org.Text                = booking.Organisation.Name;
            lblBooking_Provider.Text           = booking.Provider.Person.FullnameWithoutMiddlename;
            lblBooking_Patient.Text            = patientText;  // booking.Patient.Person.FullnameWithoutMiddlename;
            lblBooking_Offering.Text           = booking.Offering == null ? "< No service >" : booking.Offering.Name;
            lblBooking_BookingStatus.Text      = booking.BookingStatus.Descr;
            lblBooking_Time.Text               = booking.DateStart.Date.ToString("dd MMM yyyy") + " - " + booking.DateStart.ToString("h:mm") + (booking.DateStart.Hour < 12 ? "am" : "pm") + "-" + booking.DateEnd.ToString("h:mm") + (booking.DateEnd.Hour < 12 ? "am" : "pm");
            lblBooking_PatientMissedAppt.Text  = booking.IsPatientMissedAppt ? "Yes" : "No";
            lblBooking_ProviderMissedAppt.Text = booking.IsProviderMissedAppt ? "Yes" : "No";
            lblBooking_Emergency.Text          = booking.IsEmergency ? "Yes" : "No";
            lblBooking_Notes.Text              = Note.GetPopupLinkTextV2(15, booking.EntityID, booking.NoteCount > 0, true, 1050, 530, "images/notes-bw-24.jpg", "images/notes-24.png");
        }
        else
        {
            booking_space.Visible                  = false;
            booking_title.Visible                  = false;
            booking_offering.Visible               = false;
            booking_patient.Visible                = false;
            booking_provider.Visible               = false;
            booking_org.Visible                    = false;
            booking_status.Visible                 = false;
            booking_apptmt_time.Visible            = false;
            booking_patiemt_missed_apptmt.Visible  = false;
            booking_provider_missed_apptmt.Visible = false;
            booking_isemergency.Visible            = false;
            booking_notes.Visible                  = false;
        }
    }
Exemplo n.º 3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (Session["DoctorGUID"] == null)
            {
                Util.ShowMessage("用户登录超时,请重新登录!", "Login.aspx");
                Response.End();
            }
            else
            {
                if (Request.QueryString["GUID"] != null)
                {
                    using (SqlConnection conn = new DB().GetConnection())
                    {
                        GUIDS = Request.QueryString["GUID"].ToString();
                        SqlCommand cmd = conn.CreateCommand();
                        cmd.CommandText = "select * from Patient where GUID=@GUID";
                        cmd.Parameters.AddWithValue("@GUID", Request.QueryString["GUID"].ToString());
                        conn.Open();
                        SqlDataReader rd = cmd.ExecuteReader();
                        if (rd.Read())
                        {
                            Patient.Text  = rd["PatientName"].ToString();
                            GUID.Text     = rd["GUID"].ToString();
                            Sex.Text      = rd["Sex"].ToString();
                            Birthday.Text = String.Format("{0:yyyy-MM-dd}", rd["Birthday"]);
                            Num1.Text     = rd["Num1"].ToString();

                            Phone1.Text = rd["Phone1"].ToString();
                        }
                        rd.Close();

                        DoctorGUID.Text = Session["DoctorGUID"].ToString();
                        cmd.CommandText = "select * from Doctor where GUID=@DoctorGUID";
                        cmd.Parameters.AddWithValue("@DoctorGUID", DoctorGUID.Text);
                        rd = cmd.ExecuteReader();
                        if (rd.Read())
                        {
                            DoctorName.Text = rd["DoctorName"].ToString();
                        }
                        rd.Close();

                        // T1
                        cmd.CommandText = "select GUID,EndDT from T1 where PatientGUID=@GUID Order by EndDT Desc";
                        rd = cmd.ExecuteReader();
                        Repeater1.DataSource = rd;
                        Repeater1.DataBind();
                        rd.Close();

                        // T2
                        cmd.CommandText = "select GUID,EndDT from T2 where PatientGUID=@GUID Order by EndDT Desc";
                        rd = cmd.ExecuteReader();
                        Repeater2.DataSource = rd;
                        Repeater2.DataBind();
                        rd.Close();

                        // T3
                        cmd.CommandText = "select GUID,EndDT from T3 where PatientGUID=@GUID Order by EndDT Desc";
                        rd = cmd.ExecuteReader();
                        Repeater3.DataSource = rd;
                        Repeater3.DataBind();
                        rd.Close();

                        // T4
                        cmd.CommandText = "select GUID,EndDT from T4 where PatientGUID=@GUID Order by EndDT Desc";
                        rd = cmd.ExecuteReader();
                        Repeater4.DataSource = rd;
                        Repeater4.DataBind();
                        rd.Close();

                        // T5
                        cmd.CommandText = "select GUID,EndDT from T5 where PatientGUID=@GUID Order by EndDT Desc";
                        rd = cmd.ExecuteReader();
                        Repeater5.DataSource = rd;
                        Repeater5.DataBind();
                        rd.Close();

                        // T6
                        cmd.CommandText = "select GUID,EndDT from T6 where PatientGUID=@GUID Order by EndDT Desc";
                        rd = cmd.ExecuteReader();
                        Repeater6.DataSource = rd;
                        Repeater6.DataBind();
                        rd.Close();

                        // T7
                        cmd.CommandText = "select GUID,EndDT from T7 where PatientGUID=@GUID Order by EndDT Desc";
                        rd = cmd.ExecuteReader();
                        Repeater7.DataSource = rd;
                        Repeater7.DataBind();
                        rd.Close();

                        //T8
                        cmd.CommandText = "select GUID,EndDT from T8 where PatientGUID=@GUID Order by EndDT Desc";
                        rd = cmd.ExecuteReader();
                        Repeater8.DataSource = rd;
                        Repeater8.DataBind();
                        rd.Close();

                        // T9
                        cmd.CommandText = "select GUID,EndDT from T9 where PatientGUID=@GUID Order by EndDT Desc";
                        rd = cmd.ExecuteReader();
                        Repeater9.DataSource = rd;
                        Repeater9.DataBind();
                        rd.Close();

                        // T10
                        cmd.CommandText = "select GUID,EndDT from T10 where PatientGUID=@GUID Order by EndDT Desc";
                        rd = cmd.ExecuteReader();
                        Repeater10.DataSource = rd;
                        Repeater10.DataBind();
                        rd.Close();

                        // T11
                        cmd.CommandText = "select GUID,EndDT from T11 where PatientGUID=@GUID Order by EndDT Desc";
                        rd = cmd.ExecuteReader();
                        Repeater11.DataSource = rd;
                        Repeater11.DataBind();
                        rd.Close();

                        // T12
                        cmd.CommandText = "select GUID,EndDT from T12 where PatientGUID=@GUID Order by EndDT Desc";
                        rd = cmd.ExecuteReader();
                        Repeater12.DataSource = rd;
                        Repeater12.DataBind();
                        rd.Close();

                        // T13
                        cmd.CommandText = "select GUID,EndDT from T13 where PatientGUID=@GUID Order by EndDT Desc";
                        rd = cmd.ExecuteReader();
                        Repeater13.DataSource = rd;
                        Repeater13.DataBind();
                        rd.Close();

                        // T14
                        cmd.CommandText = "select GUID,EndDT from T14 where PatientGUID=@GUID Order by EndDT Desc";
                        rd = cmd.ExecuteReader();
                        Repeater14.DataSource = rd;
                        Repeater14.DataBind();
                        rd.Close();

                        // T15
                        cmd.CommandText = "select GUID,EndDT from T15 where PatientGUID=@GUID Order by EndDT Desc";
                        rd = cmd.ExecuteReader();
                        Repeater15.DataSource = rd;
                        Repeater15.DataBind();
                        rd.Close();

                        // T16
                        cmd.CommandText = "select GUID,EndDT from T16 where PatientGUID=@GUID Order by EndDT Desc";
                        rd = cmd.ExecuteReader();
                        Repeater16.DataSource = rd;
                        Repeater16.DataBind();
                        rd.Close();

                        // T17
                        cmd.CommandText = "select GUID,EndDT from T17 where PatientGUID=@GUID Order by EndDT Desc";
                        rd = cmd.ExecuteReader();
                        Repeater17.DataSource = rd;
                        Repeater17.DataBind();
                        rd.Close();

                        // T18
                        cmd.CommandText = "select GUID,EndDT from T18 where PatientGUID=@GUID Order by EndDT Desc";
                        rd = cmd.ExecuteReader();
                        Repeater18.DataSource = rd;
                        Repeater18.DataBind();
                        rd.Close();

                        // T19
                        cmd.CommandText = "select GUID,EndDT from T19 where PatientGUID=@GUID Order by EndDT Desc";
                        rd = cmd.ExecuteReader();
                        Repeater19.DataSource = rd;
                        Repeater19.DataBind();
                        rd.Close();

                        // T20
                        cmd.CommandText = "select GUID,EndDT from T20 where PatientGUID=@GUID Order by EndDT Desc";
                        rd = cmd.ExecuteReader();
                        Repeater20.DataSource = rd;
                        Repeater20.DataBind();
                        rd.Close();

                        // T21
                        cmd.CommandText = "select GUID,EndDT from T21 where PatientGUID=@GUID Order by EndDT Desc";
                        rd = cmd.ExecuteReader();
                        Repeater21.DataSource = rd;
                        Repeater21.DataBind();
                        rd.Close();

                        // T22
                        cmd.CommandText = "select GUID,EndDT from T22 where PatientGUID=@GUID Order by EndDT Desc";
                        rd = cmd.ExecuteReader();
                        Repeater22.DataSource = rd;
                        Repeater22.DataBind();
                        rd.Close();

                        // T23
                        cmd.CommandText = "select GUID,EndDT from T23 where PatientGUID=@GUID Order by EndDT Desc";
                        rd = cmd.ExecuteReader();
                        Repeater23.DataSource = rd;
                        Repeater23.DataBind();
                        rd.Close();

                        // T24
                        cmd.CommandText = "select GUID,EndDT from T24 where PatientGUID=@GUID Order by EndDT Desc";
                        rd = cmd.ExecuteReader();
                        Repeater24.DataSource = rd;
                        Repeater24.DataBind();
                        rd.Close();

                        // T25
                        cmd.CommandText = "select GUID,EndDT from T25 where PatientGUID=@GUID Order by EndDT Desc";
                        rd = cmd.ExecuteReader();
                        Repeater25.DataSource = rd;
                        Repeater25.DataBind();
                        rd.Close();

                        // T26
                        cmd.CommandText = "select GUID,EndDT from T26 where PatientGUID=@GUID Order by EndDT Desc";
                        rd = cmd.ExecuteReader();
                        Repeater26.DataSource = rd;
                        Repeater26.DataBind();
                        rd.Close();

                        // T27
                        cmd.CommandText = "select GUID,EndDT from T27 where PatientGUID=@GUID Order by EndDT Desc";
                        rd = cmd.ExecuteReader();
                        Repeater27.DataSource = rd;
                        Repeater27.DataBind();
                        rd.Close();

                        // T28
                        cmd.CommandText = "select GUID,EndDT from T28 where PatientGUID=@GUID Order by EndDT Desc";
                        rd = cmd.ExecuteReader();
                        Repeater28.DataSource = rd;
                        Repeater28.DataBind();
                        rd.Close();

                        conn.Close();
                    }
                }
                else
                {
                    Response.Write(" <script> alert(\"请先选择测试对象,再选择其完成的测试进行打印!\");;window.location='Patient_List.aspx'; </script> ");
                }
            }
        }
    }