Exemplo n.º 1
0
        //
        /// <summary>
        /// Fills the moh visitsheet.
        /// </summary>
        /// <param name="theApp">The application.</param>
        private void fillMohVisitsheet(Excel.Spreadsheet theApp)
        {
            Int32  theColIdx = 73;
            Int32  theRepIdx = 64;
            string xlcolumn;

            isvisitSheet = true;
            string lastcolumn = string.Empty;

            Excel.Worksheet worksheet = (Excel.Worksheet)theApp.Sheets[3];
            writeInCell(worksheet, "E5", "Patientvisitinfo", "IQNumber", 0);
            //xlcolumn = 'I';
            Excel.Range theRange;
            for (int a = 0; a < theRepDS.Tables["IEFuinfopervisit"].Rows.Count; a++)
            {
                visitid = Convert.ToInt32(theRepDS.Tables["IEFuinfopervisit"].Rows[a]["Visit_id"].ToString());
                if (a > 17)
                {
                    if (theColIdx > 90)
                    {
                        theColIdx = 65;
                        theRepIdx = theRepIdx + 1;
                    }

                    xlcolumn  = Convert.ToChar(theRepIdx).ToString() + Convert.ToChar(theColIdx).ToString();
                    theColIdx = theColIdx + 1;
                }
                else
                {
                    xlcolumn  = Convert.ToChar(theColIdx).ToString();
                    theColIdx = theColIdx + 1;
                }

                if (a > 0)
                {
                    writeInCell(worksheet, xlcolumn + "7", "", "V" + (a + 1).ToString(), 0);
                    //
                    theRange = (Excel.Range)theApp.ActiveSheet.Cells[7, 73 + a];
                    theRange.EntireRow.Font.set_Bold(true);



                    for (int b = 7; b <= 44; b++)
                    {
                        theRange = worksheet.Cells.get_Range(xlcolumn + b.ToString(), xlcolumn + b.ToString());
                        theRange.BorderAround(Excel.XlLineStyle.xlContinuous, Excel.XlBorderWeight.xlThin, Excel.XlColorIndex.xlColorIndexAutomatic, 1);
                    }
                }
                lastcolumn = xlcolumn;
                writeCellWiseInExcel(worksheet, xlcolumn, a);
            }
            /////////////////////
            if (!string.IsNullOrEmpty(lastcolumn))
            {
                theRange = worksheet.get_Range("B4", lastcolumn + "6");
                theRange.BorderAround(Excel.XlLineStyle.xlContinuous, Excel.XlBorderWeight.xlMedium, Excel.XlColorIndex.xlColorIndexAutomatic, 1);


                theRange = worksheet.get_Range("B7", lastcolumn + "7");
                theRange.BorderAround(Excel.XlLineStyle.xlContinuous, Excel.XlBorderWeight.xlMedium, Excel.XlColorIndex.xlColorIndexAutomatic, 1);

                object obj = new Object();
                obj = (object)("0xD8D8D8").ToString();
                theRange.Interior.set_Color(ref obj);

                theRange = worksheet.get_Range("B4", lastcolumn + "44");
                theRange.BorderAround(Excel.XlLineStyle.xlContinuous, Excel.XlBorderWeight.xlMedium, Excel.XlColorIndex.xlColorIndexAutomatic, 1);

                theRange = worksheet.get_Range("B10", lastcolumn + "11");
                theRange.BorderAround(Excel.XlLineStyle.xlContinuous, Excel.XlBorderWeight.xlMedium, Excel.XlColorIndex.xlColorIndexAutomatic, 1);

                theRange = worksheet.get_Range("B12", lastcolumn + "15");
                theRange.BorderAround(Excel.XlLineStyle.xlContinuous, Excel.XlBorderWeight.xlMedium, Excel.XlColorIndex.xlColorIndexAutomatic, 1);

                theRange = worksheet.get_Range("B16", lastcolumn + "17");
                theRange.BorderAround(Excel.XlLineStyle.xlContinuous, Excel.XlBorderWeight.xlMedium, Excel.XlColorIndex.xlColorIndexAutomatic, 1);

                theRange = worksheet.get_Range("B18", lastcolumn + "19");
                theRange.BorderAround(Excel.XlLineStyle.xlContinuous, Excel.XlBorderWeight.xlMedium, Excel.XlColorIndex.xlColorIndexAutomatic, 1);

                theRange = worksheet.get_Range("B20", lastcolumn + "21");
                theRange.BorderAround(Excel.XlLineStyle.xlContinuous, Excel.XlBorderWeight.xlMedium, Excel.XlColorIndex.xlColorIndexAutomatic, 1);

                theRange = worksheet.get_Range("B22", lastcolumn + "22");
                theRange.BorderAround(Excel.XlLineStyle.xlContinuous, Excel.XlBorderWeight.xlMedium, Excel.XlColorIndex.xlColorIndexAutomatic, 1);

                theRange = worksheet.get_Range("B23", lastcolumn + "23");
                theRange.BorderAround(Excel.XlLineStyle.xlContinuous, Excel.XlBorderWeight.xlMedium, Excel.XlColorIndex.xlColorIndexAutomatic, 1);

                theRange = worksheet.get_Range("B24", lastcolumn + "24");
                theRange.BorderAround(Excel.XlLineStyle.xlContinuous, Excel.XlBorderWeight.xlMedium, Excel.XlColorIndex.xlColorIndexAutomatic, 1);


                theRange = worksheet.get_Range("B25", lastcolumn + "26");
                theRange.BorderAround(Excel.XlLineStyle.xlContinuous, Excel.XlBorderWeight.xlMedium, Excel.XlColorIndex.xlColorIndexAutomatic, 1);


                theRange = worksheet.get_Range("B27", lastcolumn + "27");
                theRange.BorderAround(Excel.XlLineStyle.xlContinuous, Excel.XlBorderWeight.xlMedium, Excel.XlColorIndex.xlColorIndexAutomatic, 1);

                theRange = worksheet.get_Range("B28", lastcolumn + "28");
                theRange.BorderAround(Excel.XlLineStyle.xlContinuous, Excel.XlBorderWeight.xlMedium, Excel.XlColorIndex.xlColorIndexAutomatic, 1);

                theRange = worksheet.get_Range("B29", lastcolumn + "31");
                theRange.BorderAround(Excel.XlLineStyle.xlContinuous, Excel.XlBorderWeight.xlMedium, Excel.XlColorIndex.xlColorIndexAutomatic, 1);

                theRange = worksheet.get_Range("B32", lastcolumn + "36");
                theRange.BorderAround(Excel.XlLineStyle.xlContinuous, Excel.XlBorderWeight.xlMedium, Excel.XlColorIndex.xlColorIndexAutomatic, 1);


                theRange = worksheet.get_Range("B37", lastcolumn + "37");
                theRange.BorderAround(Excel.XlLineStyle.xlContinuous, Excel.XlBorderWeight.xlMedium, Excel.XlColorIndex.xlColorIndexAutomatic, 1);

                theRange = worksheet.get_Range("B38", lastcolumn + "38");
                theRange.BorderAround(Excel.XlLineStyle.xlContinuous, Excel.XlBorderWeight.xlMedium, Excel.XlColorIndex.xlColorIndexAutomatic, 1);


                theRange = worksheet.get_Range("B39", lastcolumn + "42");
                theRange.BorderAround(Excel.XlLineStyle.xlContinuous, Excel.XlBorderWeight.xlMedium, Excel.XlColorIndex.xlColorIndexAutomatic, 1);

                theRange = worksheet.get_Range("B43", lastcolumn + "43");
                theRange.BorderAround(Excel.XlLineStyle.xlContinuous, Excel.XlBorderWeight.xlMedium, Excel.XlColorIndex.xlColorIndexAutomatic, 1);

                theRange = worksheet.get_Range("B44", lastcolumn + "44");
                theRange.BorderAround(Excel.XlLineStyle.xlContinuous, Excel.XlBorderWeight.xlMedium, Excel.XlColorIndex.xlColorIndexAutomatic, 1);
                //////////////////////////
            }
            else
            {
                theRange = worksheet.get_Range("B4", "I6");
                theRange.BorderAround(Excel.XlLineStyle.xlContinuous, Excel.XlBorderWeight.xlMedium, Excel.XlColorIndex.xlColorIndexAutomatic, 1);


                theRange = worksheet.get_Range("B7", "I7");
                theRange.BorderAround(Excel.XlLineStyle.xlContinuous, Excel.XlBorderWeight.xlMedium, Excel.XlColorIndex.xlColorIndexAutomatic, 1);
            }

            releaseObject(theRange);
            releaseObject(worksheet);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Fills the moh reg sheet.
        /// </summary>
        /// <param name="theApp">The application.</param>
        private void fillMohRegSheet(Excel.Spreadsheet theApp)
        {
            Excel.Worksheet theSheet = (Excel.Worksheet)theApp.Sheets[2];
            writeInCell(theSheet, "F4", "patientinfo", "FacilityName", 0);
            writeInCell(theSheet, "X4", "patientinfo", "PatientClinicNumber", 0);

            writeInCell(theSheet, "S8", "patientinfo", "UniquePatNumber", 0);
            string name = theRepDS.Tables["patientinfo"].Rows[0]["FirstName"].ToString() + " " + theRepDS.Tables["patientinfo"].Rows[0]["LastName"].ToString();

            writeInCell(theSheet, "C11", "", name, 0);
            if (theRepDS.Tables["patientinfo"].Rows[0]["Gender"].ToString().Contains("Female"))
            {
                // writeInCell(theSheet, "D13", "", "N", 0);
                writeInCell(theSheet, "I13", "", "Y", 0);
            }
            else
            {
                writeInCell(theSheet, "D13", "", "Y", 0);

                // writeInCell(theSheet, "I13", "", "N", 0);
            }

            writeInCell(theSheet, "W11", "", theRepDS.Tables["PatientInfo"].Rows[0]["DOB"].ToString(), 0);;
            writeInCell(theSheet, "AD11", "patientinfo", "Age", 0);
            writeInCell(theSheet, "X13", "patientinfo", "Address", 0);
            writeInCell(theSheet, "D14", "patientinfo", "TelContact", 0);

            writeInCell(theSheet, "D15", "patientinfo", "District", 0);
            writeInCell(theSheet, "W15", "patientinfo", "Location", 0);


            writeInCell(theSheet, "D16", "patientinfo", "SubLocation", 0);
            writeInCell(theSheet, "W16", "patientinfo", "LandMark", 0);

            if (theRepDS.Tables["patientinfo"].Rows[0]["MaritalStatus"].ToString().Contains("Single"))
            {
                writeInCell(theSheet, "T21", "", "Y", 0);
            }
            else if (theRepDS.Tables["patientinfo"].Rows[0]["MaritalStatus"].ToString().Contains("Married"))
            {
                writeInCell(theSheet, "D21", "", "Y", 0);
            }
            else if (theRepDS.Tables["patientinfo"].Rows[0]["MaritalStatus"].ToString().Contains("Divorced"))
            {
                writeInCell(theSheet, "N19", "", "Y", 0);
            }
            else if (theRepDS.Tables["patientinfo"].Rows[0]["MaritalStatus"].ToString().Contains("Cohabiting"))
            {
                writeInCell(theSheet, "T19", "", "Y", 0);
            }
            else if (theRepDS.Tables["patientinfo"].Rows[0]["MaritalStatus"].ToString().Contains("Married Polygamous"))
            {
                writeInCell(theSheet, "D19", "", "Y", 0);
            }
            else if (theRepDS.Tables["patientinfo"].Rows[0]["MaritalStatus"].ToString().Contains("Married Monogamous"))
            {
                writeInCell(theSheet, "D21", "", "Y", 0);
            }
            else if (theRepDS.Tables["patientinfo"].Rows[0]["MaritalStatus"].ToString().Contains("Widowed"))
            {
                writeInCell(theSheet, "N21", "", "Y", 0);
            }


            // EmergContact
            writeInCell(theSheet, "F23", "EmergContact", "TSName", 0);
            writeInCell(theSheet, "Y23", "EmergContact", "TSRelation", 0);
            writeInCell(theSheet, "F24", "EmergContact", "TSAddress", 0);
            writeInCell(theSheet, "W24", "EmergContact", "TSPhone", 0);

            //
            //  for (int i = 0; i < theRepDS.Tables["Referred"].Rows.Count; i++)
            if (theRepDS.Tables["Referred"].Rows.Count > 0)
            {
                if (theRepDS.Tables["Referred"].Rows[0]["ReferredFrom"].ToString().Contains("VCT"))
                {
                    writeInCell(theSheet, "D30", "", "Y", 0);
                }
                else if (theRepDS.Tables["Referred"].Rows[0]["ReferredFrom"].ToString().Contains("PMTCT"))
                {
                    writeInCell(theSheet, "D28", "", "Y", 0);
                }
                else if (theRepDS.Tables["Referred"].Rows[0]["ReferredFrom"].ToString().Contains("IPD - Ad"))
                {
                    writeInCell(theSheet, "N28", "", "Y", 0);
                }
                else if (theRepDS.Tables["Referred"].Rows[0]["ReferredFrom"].ToString().Contains("TB Clinic"))
                {
                    writeInCell(theSheet, "V28", "", "Y", 0);
                }
                else if (theRepDS.Tables["Referred"].Rows[0]["ReferredFrom"].ToString().Contains("OPD"))
                {
                    writeInCell(theSheet, "AD28", "", "Y", 0);
                }
                else if (theRepDS.Tables["Referred"].Rows[0]["ReferredFrom"].ToString().Contains("IPD - Ch"))
                {
                    writeInCell(theSheet, "L30", "", "Y", 0);
                }
                else if (theRepDS.Tables["Referred"].Rows[0]["ReferredFrom"].ToString().Contains("MCH child"))
                {
                    writeInCell(theSheet, "V30", "", "Y", 0);
                }
                else
                {
                    writeInCell(theSheet, "D32", "", "Y", 0);
                    writeInCell(theSheet, "M32", "Referred", "Transfered From Facility", 0);
                }
            }

            writeInCell(theSheet, "G34", "Referred", "TransferInDate", 0);
            writeInCell(theSheet, "V34", "Referred", "ReferredFrom", 0);
            writeInCell(theSheet, "G36", "Referred", "Transfered From Facility", 0);
            writeInCell(theSheet, "Z36", "Referred", "ARTStartDate", 0);

            //PrevARV
            if (theRepDS.Tables["PrevARV"].Rows.Count > 0)
            {
                if (!String.IsNullOrEmpty(Convert.ToString(theRepDS.Tables["PrevARV"].Rows[0]["PrevARV1"])))
                {
                    writeInCell(theSheet, "P43", "PrevARV", "PrevARV1", 0);
                    writeInCell(theSheet, "AB43", "PrevARV", "PrevARV1dtUsed", 0);
                }

                if (!String.IsNullOrEmpty(Convert.ToString(theRepDS.Tables["PrevARV"].Rows[0]["PrevARV2"])))
                {
                    writeInCell(theSheet, "P45", "PrevARV", "PrevARV2", 0);
                    writeInCell(theSheet, "AB45", "PrevARV", "PrevARV2dtUsed", 0);
                }
                if (!String.IsNullOrEmpty(Convert.ToString(theRepDS.Tables["PrevARV"].Rows[0]["PrevARV3"])))
                {
                    writeInCell(theSheet, "P47", "PrevARV", "PrevARV3", 0);
                    writeInCell(theSheet, "AB47", "PrevARV", "PrevARV3dtUsed", 0);
                }
            }
            //HIVDiagnosis
            writeInCell(theSheet, "I49", "HIVDiagnosis", "DtConfirmHIVPositive", 0);
            writeInCell(theSheet, "I50", "HIVDiagnosis", "dtEnrolledHIVCare", 0);
            writeInCell(theSheet, "AB51", "HIVDiagnosis", "WHOStage", 0);
            writeInCell(theSheet, "I51", "patientAllergy", "Allergy", 0);

            //FamilyInfo
            for (int i = 0; i < 5; i++)
            {
                writeInCell(theSheet, "C" + (57 + i).ToString(), "", (i + 1).ToString(), 0);
                writeInCell(theSheet, "D" + (57 + i).ToString(), "FamilyInfo", "RName", i);
                writeInCell(theSheet, "K" + (57 + i).ToString(), "FamilyInfo", "AgeYear", i);
                writeInCell(theSheet, "M" + (57 + i).ToString(), "FamilyInfo", "Relation", i);

                writeInCell(theSheet, "T" + (57 + i).ToString(), "FamilyInfo", "HIVStatus", i);
                writeInCell(theSheet, "W" + (57 + i).ToString(), "FamilyInfo", "InCare", i);
                writeInCell(theSheet, "Z" + (57 + i).ToString(), "FamilyInfo", "CCCNumber", i);
            }

            //
            if (theRepDS.Tables["patientlabresults"].Rows.Count > 0)
            {
                // if (!String.IsNullOrEmpty(theRepDS.Tables["patientlabresults"].Rows[0]["CD4Count"].ToString()))
                // {
                writeInCell(theSheet, "BA10", "", "Y", 0);
                writeInCell(theSheet, "BI11", "patientlabresults", "CD4Count", 0);
                writeInCell(theSheet, "AV11", "patientlabresults", "WHOStage", 0);
                writeInCell(theSheet, "AO17", "patientlabresults", "Weight", 0);
                writeInCell(theSheet, "AV17", "patientlabresults", "Height", 0);
                writeInCell(theSheet, "BD17", "patientlabresults", "BMI", 0);
                writeInCell(theSheet, "BK17", "patientlabresults", "WHOStage", 0);
                // }
            }
            for (int i = 0; i < 3; i++)
            {
                writeInCell(theSheet, "AS" + (i + 22).ToString(), "firstgegimen", "RegimenType", i);
                writeInCell(theSheet, "AK" + (i + 22).ToString(), "firstgegimen", "RegDate", i);
            }

            releaseObject(theSheet);
        }
Exemplo n.º 3
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            try
            {
                if (validation() == false)
                {
                    return;
                }
                IQCareUtils theUtils = new IQCareUtils();


                if ((ddQuarter.SelectedValue.ToString() != "0") && (txtyears.Text.Trim() != ""))
                {
                    IReports ReportDetails = (IReports)ObjectFactory.CreateInstance("BusinessProcess.Reports.BReports,BusinessProcess.Reports");
                    theRepQuarterDS = (DataSet)ReportDetails.GetNACPQuarterlyReportData(Convert.ToInt32(ddQuarter.SelectedValue.ToString()), Convert.ToInt32(txtyears.Text.Trim()), Convert.ToInt32(Session["AppLocationId"]));

                    #region "TableNames"
                    theRepQuarterDS.Tables[0].TableName = "FacilityInfo1";
                    theRepQuarterDS.Tables[1].TableName = "Table1Data1";
                    theRepQuarterDS.Tables[2].TableName = "Table2Data1";

                    #endregion
                    Excel.Spreadsheet theApp      = new Microsoft.Office.Interop.Owc11.Spreadsheet();
                    string            theFilePath = Server.MapPath("..\\ExcelFiles\\Templates\\TZNACPQuarterlyReport.xml");
                    theApp.XMLURL = theFilePath;
                    writeCellWiseInExcel(theApp);

                    //theApp.Export(Server.MapPath("..\\ExcelFiles\\TZNACPQuarterlyReport.xls"), Microsoft.Office.Interop.Owc11.SheetExportActionEnum.ssExportActionOpenInExcel, Microsoft.Office.Interop.Owc11.SheetExportFormat.ssExportXMLSpreadsheet);
                    theApp.Export(Server.MapPath("..\\ExcelFiles\\TZNACPQuarterlyReport.xls"), Microsoft.Office.Interop.Owc11.SheetExportActionEnum.ssExportActionNone, Microsoft.Office.Interop.Owc11.SheetExportFormat.ssExportXMLSpreadsheet);
                    //theUtils.OpenExcelFile(Server.MapPath("..\\ExcelFiles\\TZNACPQuarterlyReport.xls"),Response);
                    IQWebUtils theUtl = new IQWebUtils();
                    theUtl.ShowExcelFile(Server.MapPath("..\\ExcelFiles\\TZNACPQuarterlyReport.xls"), Response);
                }
                else if ((ddMonth.SelectedValue.ToString() != "0") && (txtYear.Text.Trim() != ""))
                {
                    int years  = Convert.ToInt32(txtYear.Text);
                    int Months = Convert.ToInt32(ddMonth.SelectedItem.Value);

                    IReports ReportDetails = (IReports)ObjectFactory.CreateInstance("BusinessProcess.Reports.BReports,BusinessProcess.Reports");
                    theRepDS = (DataSet)ReportDetails.GetNACPMonthlyReportData(Months, years, Convert.ToInt32(Session["AppLocationId"]));

                    #region "TableNames"
                    theRepDS.Tables[0].TableName = "FacilityInfo";
                    theRepDS.Tables[1].TableName = "Table1Data";
                    theRepDS.Tables[2].TableName = "Table2Data";
                    #endregion


                    //Response.Redirect("..\\ExcelFiles\\TZNACPMonthlyReport.xls");
                    Excel.Spreadsheet theApp      = new Microsoft.Office.Interop.Owc11.Spreadsheet();
                    string            theFilePath = Server.MapPath("..\\ExcelFiles\\Templates\\TanzaniaNACPMonthlyreport.xml");
                    theApp.XMLURL = theFilePath;
                    writeCellWiseInExcel(theApp);

                    // theApp.Export(Server.MapPath("..\\ExcelFiles\\TZNACPMonthlyReport.xls"), Microsoft.Office.Interop.Owc11.SheetExportActionEnum.ssExportActionOpenInExcel, Microsoft.Office.Interop.Owc11.SheetExportFormat.ssExportAsAppropriate);
                    theApp.Export(Server.MapPath("..\\ExcelFiles\\TZNACPMonthlyReport.xls"), Microsoft.Office.Interop.Owc11.SheetExportActionEnum.ssExportActionNone, Microsoft.Office.Interop.Owc11.SheetExportFormat.ssExportXMLSpreadsheet);
                    //theUtils.OpenExcelFile(Server.MapPath("..\\ExcelFiles\\TZNACPMonthlyReport.xls"), Response);
                    IQWebUtils theUtl = new IQWebUtils();
                    theUtl.ShowExcelFile(Server.MapPath("..\\ExcelFiles\\TZNACPMonthlyReport.xls"), Response);
                }
            }
            catch (Exception err)
            {
                MsgBuilder theBuilder = new MsgBuilder();
                theBuilder.DataElements["MessageText"] = err.Message.ToString();
                IQCareMsgBox.Show("#C1", theBuilder, this);
                return;
            }
        }
Exemplo n.º 4
0
        //  private void writeCellWiseInExcel(Excel.Spreadsheet theSheet) { }
        private void writeCellWiseInExcel(Excel.Spreadsheet theSheet)
        {
            try
            {
                if ((ddQuarter.SelectedValue.ToString() != "0") && (txtyears.Text != ""))
                {
                    // theSheet.
                    writeInCell(theSheet, "C4", "FacilityInfo1", "Date");
                    writeInCell(theSheet, "C6", "FacilityInfo1", "FacilityName");
                    writeInCell(theSheet, "C8", "FacilityInfo1", "District");
                    writeInCell(theSheet, "E4", "", Application["AppCurrentDate"].ToString());
                    writeInCell(theSheet, "E8", "FacilityInfo1", "Region");

                    writeInCell(theSheet, "E15", theRepQuarterDS.Tables[1].TableName.ToString(), "Table3ColE15");
                    writeInCell(theSheet, "E16", theRepQuarterDS.Tables[1].TableName.ToString(), "Table3ColE16");
                    writeInCell(theSheet, "E17", theRepQuarterDS.Tables[1].TableName.ToString(), "Table3ColE17");
                    writeInCell(theSheet, "E18", theRepQuarterDS.Tables[1].TableName.ToString(), "Table3ColE18");

                    writeInCell(theSheet, "E21", theRepQuarterDS.Tables[1].TableName.ToString(), "Table3ColE21");
                    writeInCell(theSheet, "E22", theRepQuarterDS.Tables[1].TableName.ToString(), "Table3ColE22");
                    writeInCell(theSheet, "E23", theRepQuarterDS.Tables[1].TableName.ToString(), "Table3ColE23");
                    writeInCell(theSheet, "E24", theRepQuarterDS.Tables[1].TableName.ToString(), "Table3ColE24");

                    writeInCell(theSheet, "D35", theRepQuarterDS.Tables[2].TableName.ToString(), "Table4ColD35");
                    writeInCell(theSheet, "D36", theRepQuarterDS.Tables[2].TableName.ToString(), "Table4ColD36");
                    writeInCell(theSheet, "D37", theRepQuarterDS.Tables[2].TableName.ToString(), "Table4ColD37");
                    writeInCell(theSheet, "D38", theRepQuarterDS.Tables[2].TableName.ToString(), "Table4ColD38");

                    writeInCell(theSheet, "D41", theRepQuarterDS.Tables[2].TableName.ToString(), "Table4ColD41");
                    writeInCell(theSheet, "E41", theRepQuarterDS.Tables[2].TableName.ToString(), "Table4ColE41");
                }
                else if ((ddMonth.SelectedValue.ToString() != "0") && (txtYear.Text.Trim() != ""))
                {
                    writeInCell(theSheet, "C5", "FacilityInfo", "Date");
                    writeInCell(theSheet, "C7", "FacilityInfo", "FacilityName");
                    writeInCell(theSheet, "C9", "FacilityInfo", "District");
                    writeInCell(theSheet, "E5", "", Application["AppCurrentDate"].ToString());
                    writeInCell(theSheet, "E9", "FacilityInfo", "Region");

                    writeInCell(theSheet, "D16", theRepDS.Tables[1].TableName.ToString(), "Table1ColD16");
                    writeInCell(theSheet, "D17", theRepDS.Tables[1].TableName.ToString(), "Table1ColD17");
                    writeInCell(theSheet, "D18", theRepDS.Tables[1].TableName.ToString(), "Table1ColD18");
                    writeInCell(theSheet, "D19", theRepDS.Tables[1].TableName.ToString(), "Table1ColD19");

                    writeInCell(theSheet, "E16", theRepDS.Tables[1].TableName.ToString(), "Table1ColE16");
                    writeInCell(theSheet, "E17", theRepDS.Tables[1].TableName.ToString(), "Table1ColE17");
                    writeInCell(theSheet, "E18", theRepDS.Tables[1].TableName.ToString(), "Table1ColE18");
                    writeInCell(theSheet, "E19", theRepDS.Tables[1].TableName.ToString(), "Table1ColE19");

                    writeInCell(theSheet, "G16", theRepDS.Tables[1].TableName.ToString(), "Table1ColG16");
                    writeInCell(theSheet, "G17", theRepDS.Tables[1].TableName.ToString(), "Table1ColG17");
                    writeInCell(theSheet, "G18", theRepDS.Tables[1].TableName.ToString(), "Table1ColG18");
                    writeInCell(theSheet, "G19", theRepDS.Tables[1].TableName.ToString(), "Table1ColG19");

                    writeInCell(theSheet, "D24", theRepDS.Tables[2].TableName.ToString(), "Table2ColD24");
                    writeInCell(theSheet, "D25", theRepDS.Tables[2].TableName.ToString(), "Table2ColD25");
                    writeInCell(theSheet, "D26", theRepDS.Tables[2].TableName.ToString(), "Table2ColD26");
                    writeInCell(theSheet, "D27", theRepDS.Tables[2].TableName.ToString(), "Table2ColD27");
                    writeInCell(theSheet, "D29", theRepDS.Tables[2].TableName.ToString(), "Table2ColD29");
                    writeInCell(theSheet, "D30", theRepDS.Tables[2].TableName.ToString(), "Table2ColD30");

                    writeInCell(theSheet, "E24", theRepDS.Tables[2].TableName.ToString(), "Table2ColE24");
                    writeInCell(theSheet, "E25", theRepDS.Tables[2].TableName.ToString(), "Table2ColE25");
                    writeInCell(theSheet, "E26", theRepDS.Tables[2].TableName.ToString(), "Table2ColE26");
                    writeInCell(theSheet, "E27", theRepDS.Tables[2].TableName.ToString(), "Table2ColE27");
                    writeInCell(theSheet, "E29", theRepDS.Tables[2].TableName.ToString(), "Table2ColE29");
                    writeInCell(theSheet, "E30", theRepDS.Tables[2].TableName.ToString(), "Table2ColE30");
                    writeInCell(theSheet, "F32", theRepDS.Tables[2].TableName.ToString(), "Table2ColF32");
                }
            }
            catch (Exception err)
            {
                MsgBuilder theBuilder = new MsgBuilder();
                theBuilder.DataElements["MessageText"] = err.Message.ToString();
                IQCareMsgBox.Show("#C1", theBuilder, this);
                return;
            }
        }
Exemplo n.º 5
0
        private void writeInCell(Excel.Spreadsheet theSheet, string cell, string tablename, string column)
        {
            Excel.Range theRange = theSheet.Cells.get_Range(cell, cell);
            //theRange.Value2
            //theRange.WrapText = true;
            string theExitvalue = "";

            if (theRange.Value2 != null)
            {
                theExitvalue = theRange.Value2.ToString();
            }
            else
            {
                theExitvalue = "";
            }
            if ((ddQuarter.SelectedValue.ToString() != "0") && (txtyears.Text != ""))
            {
                try
                {
                    if (tablename != "")
                    {
                        if (theExitvalue.ToString().Trim() == "")
                        {
                            theRange.Value2 = theRepQuarterDS.Tables[tablename].Rows[0][column].ToString();
                        }
                        else
                        {
                            theRange.Value2 = theExitvalue + "  " + theRepQuarterDS.Tables[tablename].Rows[0][column].ToString();
                        }
                    }
                    else
                    {
                        if (theExitvalue.ToString().Trim() == "")
                        {
                            theRange.Value2 = column;
                        }
                        else
                        {
                            theRange.Value2 = theExitvalue + "  " + column;
                        }
                    }
                }
                catch (Exception err)
                {
                    MsgBuilder theBuilder = new MsgBuilder();
                    theBuilder.DataElements["MessageText"] = err.Message.ToString();
                    IQCareMsgBox.Show("#C1", theBuilder, this);
                    return;
                }
            }

            else if ((ddMonth.SelectedValue.ToString() != "0") && (txtYear.Text != ""))
            {
                try
                {
                    if (tablename != "")
                    {
                        if (theExitvalue.ToString().Trim() == "")
                        {
                            theRange.Value2 = theRepDS.Tables[tablename].Rows[0][column].ToString();
                        }
                        else
                        {
                            theRange.Value2 = theExitvalue + "  " + theRepDS.Tables[tablename].Rows[0][column].ToString();
                        }
                    }
                    else
                    {
                        if (theExitvalue.ToString().Trim() == "")
                        {
                            theRange.Value2 = column;
                        }
                        else
                        {
                            theRange.Value2 = theExitvalue + "  " + column;
                        }
                    }
                }

                catch (Exception err)
                {
                    MsgBuilder theBuilder = new MsgBuilder();
                    theBuilder.DataElements["MessageText"] = err.Message.ToString();
                    IQCareMsgBox.Show("#C1", theBuilder, this);
                    return;
                }
            }
        }