Пример #1
0
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
require_once 'SSRSReport.php';
//load config file variables
$settings = parse_ini_file("app.config", 1);
try {
    $ssrs_report = new SSRSReport(new Credentials($settings["UID"], $settings["PASWD"]), $settings["SERVICE_URL"]);
    $controls = null;
    if (key_exists("exportSelect", $_POST)) {
        $executionInfo = $ssrs_report->LoadReport2($_POST["reportName"], NULL);
        $parameters = getReportParameters(true);
        $ssrs_report->SetExecutionParameters2($parameters);
        $render = getRenderType($_POST["exportSelect"]);
        $result_html = $ssrs_report->Render2($render, PageCountModeEnum::$Estimate, $Extension, $MimeType, $Encoding, $Warnings, $StreamIds);
        $saveName = $_POST["exportName"] . getExtension($_POST["exportSelect"]);
        if (!($handle = fopen("./Reports/" . $saveName, 'wb'))) {
            echo "Cannot open file for writing output";
            exit;
        }
        if (fwrite($handle, $result_html) === FALSE) {
            echo "Cannot write to file";
            exit;
            $htmlString = <<<html
\t\t\t<p>Success!  Your order has been submitted to our office in Little Rock.</p>
\t\t\t<a href="/account/home/"><button type="button" class="btn btn-primary" id="homeBtn">Return Home</button></a>
html;
            echo $htmlString;
        } else {
            //Set up report server configuration and read in report parameters
            $config = \OnlineOrders\Config::get('ssrsConfig');
            $myCMN = array();
            foreach ($_POST as $key => $value) {
                $myCMN[$key] = $value;
            }
            //Try to run report and save it to watch folder
            try {
                $reportName = $myCMN['reportName'];
                $ssrs_report = new \SSRSReport(new \Credentials($config['username'], $config['password']), $config['reportServer']);
                $ssrs_report->LoadReport2($reportName, NULL);
                $parameters = array();
                $index = 0;
                foreach ($myCMN as $key => $value) {
                    //Don't include reportName as parameter
                    if ($key != 'reportName') {
                        $parameters[$index] = new \ParameterValue();
                        $parameters[$index]->Name = $key;
                        if ($value == 'Select One...') {
                            $parameters[$index]->Value = "";
                        } else {
                            $parameters[$index]->Value = $value;
                        }
                        $index++;
                    }
Пример #3
0
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
require_once 'SSRSReport.php';
define("REPORT", "/AdventureWorks 2008 Sample Reports/TopStoresBegin");
$settings = parse_ini_file("app.config", 1);
try {
    $rs = new SSRSReport(new Credentials($settings["UID"], $settings["PASWD"]), $settings["SERVICE_URL"]);
    if (isset($_REQUEST['rs:Command'])) {
        switch ($_REQUEST['rs:Command']) {
            case 'Sort':
                $rs->Sort2($_REQUEST['rs:SortId'], $_REQUEST['rs:SortDirection'], $_REQUEST['rs:ClearSort'], PageCountModeEnum::$Estimate, $ReportItem, $ExecutionInfo);
                break;
            default:
                echo 'Unknown :' . $_REQUEST['rs:Command'];
                exit;
        }
    } else {
        $executionInfo = $rs->LoadReport2(REPORT, NULL);
        $parameters = array();
        $parameters[0] = new ParameterValue();
        $parameters[0]->Name = "ProductCategory";
        $parameters[0]->Value = "1";
Пример #4
0
 public function saveSignedCMNRecursive($woundIndex = 0, $productWoundMatrix = NULL)
 {
     if ($woundIndex >= count($this->getWounds())) {
         return TRUE;
     } else {
         //Set up report server configuration and read in report parameters
         $config = \OnlineOrders\Config::get('ssrsConfig');
         if (!isset($productWoundMatrix)) {
             $productWoundMatrix = $this->getProductWoundMatrix();
         }
         $parameters = array();
         $index = 0;
         foreach ($productWoundMatrix as $prodkey => $product) {
             $parameters[$index] = new \ParameterValue();
             $parameters[$index]->Name = 'product' . ($prodkey + 1);
             $parameters[$index]->Value = $product['product'] ? $product['product']->get('description') : '';
             $index++;
             for ($i = $woundIndex; $i < $woundIndex + 4; $i++) {
                 $parameters[$index] = new \ParameterValue();
                 $parameters[$index]->Name = 'product' . ($prodkey + 1) . 'wound' . ($i % 4 + 1);
                 $parameters[$index]->Value = isset($product['wounds'][$i]['wound']) ? 'X' : '';
                 $index++;
             }
         }
         for ($i = $woundIndex; $i < $woundIndex + 4; $i++) {
             $parameters[$index] = new \ParameterValue();
             $parameters[$index]->Name = 'wound' . ($i + 1);
             $parameters[$index]->Value = '';
             $index++;
             $parameters[$index] = new \ParameterValue();
             $parameters[$index]->Name = 'wound' . ($i + 1) . 'Desc';
             if (isset($this->getWounds()[$i])) {
                 $parameters[$index]->Value = $this->getWounds()[$i]->get('shortDescription') ? $this->getWounds()[$i]->get('shortDescription') : $this->getWounds()[$i]->get('longDescription');
             } else {
                 $parameters[$index]->Value = '';
             }
             $index++;
             $parameters[$index] = new \ParameterValue();
             $parameters[$index]->Name = 'wound' . ($i + 1) . 'Size';
             $parameters[$index]->Value = isset($this->getWounds()[$i]) ? $this->getWounds()[$i]->get('dimensions')['Length'] . 'x' . $this->getWounds()[$i]->get('dimensions')['Width'] . 'x' . $this->getWounds()[$i]->get('dimensions')['Depth'] : '';
             $index++;
             $parameters[$index] = new \ParameterValue();
             $parameters[$index]->Name = 'wound' . ($i + 1) . 'Thickness';
             $parameters[$index]->Value = isset($this->getWounds()[$i]) ? $this->getWounds()[$i]->get('thickness') : '';
             $index++;
             $parameters[$index] = new \ParameterValue();
             $parameters[$index]->Name = 'wound' . ($i + 1) . 'Drainage';
             $parameters[$index]->Value = isset($this->getWounds()[$i]) ? $this->getWounds()[$i]->get('drainage') : '';
             $index++;
             $parameters[$index] = new \ParameterValue();
             $parameters[$index]->Name = 'wound' . ($i + 1) . 'Location';
             $parameters[$index]->Value = isset($this->getWounds()[$i]) ? $this->getWounds()[$i]->get('woundLoc') : '';
             $index++;
             $parameters[$index] = new \ParameterValue();
             $parameters[$index]->Name = 'wound' . ($i + 1) . 'Freq';
             $parameters[$index]->Value = isset($this->getWounds()[$i]) ? $this->getWounds()[$i]->get('FOC') : '';
             $index++;
             $parameters[$index] = new \ParameterValue();
             $parameters[$index]->Name = 'wound' . ($i + 1) . 'Dur';
             $parameters[$index]->Value = '';
             $index++;
         }
         $woundIndex = $woundIndex + 4;
         $parameters[$index] = new \ParameterValue();
         $parameters[$index]->Name = 'nursingHomeBed';
         $parameters[$index]->Value = $this->location == 31 ? 'Yes' : 'No';
         $index++;
         $parameters[$index] = new \ParameterValue();
         $parameters[$index]->Name = 'needsSaline';
         $parameters[$index]->Value = $this->saline == 0 ? 'No' : 'Yes';
         $index++;
         $parameters[$index] = new \ParameterValue();
         $parameters[$index]->Name = 'partABed';
         $parameters[$index]->Value = $this->partA == 0 ? 'No' : 'Yes';
         $index++;
         $parameters[$index] = new \ParameterValue();
         $parameters[$index]->Name = 'homeHealth';
         $parameters[$index]->Value = $this->hospice == 0 ? 'No' : 'Yes';
         $index++;
         $parameters[$index] = new \ParameterValue();
         $parameters[$index]->Name = 'cmnDate';
         $parameters[$index]->Value = $this->CMNDate;
         $index++;
         $clinic = $this->getClinic();
         $parameters[$index] = new \ParameterValue();
         $parameters[$index]->Name = 'nursingHomeName';
         $parameters[$index]->Value = $this->location == 31 ? $clinic->get('clinicInfo')['CompanyName'] : '';
         $index++;
         $clinic = $this->getClinic();
         $parameters[$index] = new \ParameterValue();
         $parameters[$index]->Name = 'clinicName';
         $parameters[$index]->Value = $this->location == 31 ? '' : $clinic->get('clinicInfo')['CompanyName'];
         $index++;
         $parameters[$index] = new \ParameterValue();
         $parameters[$index]->Name = 'nursingHomeCity';
         $parameters[$index]->Value = $this->location == 31 ? $clinic->get('clinicInfo')['City'] : '';
         $index++;
         $parameters[$index] = new \ParameterValue();
         $parameters[$index]->Name = 'clinicCity';
         $parameters[$index]->Value = $this->location == 31 ? '' : $clinic->get('clinicInfo')['City'];
         $index++;
         $parameters[$index] = new \ParameterValue();
         $parameters[$index]->Name = 'nursingHomePhone';
         $parameters[$index]->Value = $this->location == 31 ? $clinic->get('clinicInfo')['BusinessPhone'] : '';
         $index++;
         $parameters[$index] = new \ParameterValue();
         $parameters[$index]->Name = 'clinicPhone';
         $parameters[$index]->Value = $this->location == 31 ? '' : $clinic->get('clinicInfo')['BusinessPhone'];
         $index++;
         $patient = $this->getPatient();
         $parameters[$index] = new \ParameterValue();
         $parameters[$index]->Name = 'patientName';
         $parameters[$index]->Value = $patient->get('firstName') . ' ' . $patient->get('lastName');
         $index++;
         $parameters[$index] = new \ParameterValue();
         $parameters[$index]->Name = 'patientDOB';
         $parameters[$index]->Value = $patient->get('DOB');
         $index++;
         $parameters[$index] = new \ParameterValue();
         $parameters[$index]->Name = 'patientPhone';
         $parameters[$index]->Value = $patient->get('DOB');
         $index++;
         $parameters[$index] = new \ParameterValue();
         $parameters[$index]->Name = 'patientSSN';
         $parameters[$index]->Value = $patient->get('SSN');
         $index++;
         $parameters[$index] = new \ParameterValue();
         $parameters[$index]->Name = 'patientAddress';
         $parameters[$index]->Value = $patient->get('Address')['address1'] . ' ' . $patient->get('Address')['address2'];
         $index++;
         $parameters[$index] = new \ParameterValue();
         $parameters[$index]->Name = 'patientCity';
         $parameters[$index]->Value = $patient->get('Address')['city'];
         $index++;
         $parameters[$index] = new \ParameterValue();
         $parameters[$index]->Name = 'patientState';
         $parameters[$index]->Value = $patient->get('Address')['state'];
         $index++;
         $parameters[$index] = new \ParameterValue();
         $parameters[$index]->Name = 'patientZip';
         $parameters[$index]->Value = $patient->get('Address')['zip5'];
         $index++;
         $provider = $this->getProvider();
         $parameters[$index] = new \ParameterValue();
         $parameters[$index]->Name = 'physicianNPI';
         $parameters[$index]->Value = $provider->get('NPI');
         $index++;
         $parameters[$index] = new \ParameterValue();
         $parameters[$index]->Name = 'PhysicianUPIN';
         $parameters[$index]->Value = $provider->get('UPIN');
         $index++;
         $parameters[$index] = new \ParameterValue();
         $parameters[$index]->Name = 'Fax';
         $parameters[$index]->Value = $provider->get('faxNumber');
         $index++;
         $parameters[$index] = new \ParameterValue();
         $parameters[$index]->Name = 'physicianSelect';
         $parameters[$index]->Value = $provider->get('name');
         $index++;
         $parameters[$index] = new \ParameterValue();
         $parameters[$index]->Name = 'PhysicianPhone';
         $parameters[$index]->Value = $provider->get('phoneNumber');
         $index++;
         $parameters[$index] = new \ParameterValue();
         $parameters[$index]->Name = 'PhysicianCity';
         $parameters[$index]->Value = $provider->get('address')['City'];
         $index++;
         $parameters[$index] = new \ParameterValue();
         $parameters[$index]->Name = 'PhysicianState';
         $parameters[$index]->Value = $provider->get('address')['State'];
         $index++;
         $parameters[$index] = new \ParameterValue();
         $parameters[$index]->Name = 'woundsDebrided';
         $parameters[$index]->Value = 'Yes';
         $index++;
         // Try to run report and save it to watch folder
         try {
             $reportName = '/ssrsPHPTest/eSignedCMI';
             $ssrs_report = new \SSRSReport(new \Credentials($config['username'], $config['password']), $config['reportServer']);
             $ssrs_report->LoadReport2($reportName, NULL);
             $executionInfo = $ssrs_report->SetExecutionParameters2($parameters, "en-us");
             $renderAsPDF = new \RenderAsPDF();
             $renderAsPDF->PageWidth = "8.5in";
             $renderAsPDF->PageHeight = "11in";
             $result_pdf = $ssrs_report->Render2($renderAsPDF, \PageCountModeEnum::$Estimate, $Extension, $MimeType, $Encoding, $Warnings, $StreamIds);
             $date = date('m-d-Y-H.i.s');
             file_put_contents(dirname(__FILE__) . "/../../eSignatures/eSignature-" . $date . ".pdf", $result_pdf);
             // 				$htmlString = <<<html
             // 					<p>Success!  Your order has been submitted to our office in Little Rock.</p>
             // 					<a href="/account/home/"><button type="button" class="btn btn-primary" id="homeBtn">Return Home</button></a>
             // html;
             //
             // 				echo $htmlString;
         } catch (\SSRSReportException $serviceException) {
             echo $serviceException->GetErrorMessage();
         }
         //
         // 			// echo 'loop <br />';
         // 			// echo '<pre>';
         // 			// print_r($parameters);
         // 			// echo '</pre>';
         $this->saveSignedCMNRecursive($woundIndex, $productWoundMatrix);
     }
     //		return $parameters;
 }
Пример #5
0
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
require_once 'SSRSReport.php';
//load config file variables
$settings = parse_ini_file("app.config", 1);
try {
    $ssrs_report = new SSRSReport(new Credentials($settings["UID"], $settings["PASWD"]), $settings["SERVICE_URL"]);
    $result_html = null;
    $controls = null;
    //check are process 'params'request parameter
    parsePostBack();
    //We need to get the report parameters, create controls, and fill in values
    if (key_exists("reportName", $_REQUEST)) {
        $query = $_REQUEST["reportName"];
        $parmVals = getReportParameters();
        //this makes it easier to access the stored values below
        $arr = array();
        if (!empty($parmVals)) {
            foreach ($parmVals as $key => $val) {
                //error checking code to print the values retrieved
                //echo "\n<br />parameters[$key]=$val->Name:$val->Value";
                $arr[$val->Name] = $val->Value;
 public function TestConnection()
 {
     try {
         $ssrsReport = new SSRSReport(new Credentials($this->_uid, $this->_pwd), $this->_server);
         $executionInfo2 = $ssrsReport->LoadReport2($this->_report, NULL);
         if ($executionInfo2->CredentialsRequired && count($this->_dataSources) == 0) {
             $dataSourceName = $executionInfo2->DataSourcePrompts[0]->Name;
             echo "The data source '{$dataSourceName}' used by this report has been configured for credential prompt. Please provide data source credentails\n\n";
             $this->ShowUsage();
         }
         $dataSrcCredentials = array();
         if (count($this->_dataSources)) {
             foreach ($this->_dataSources as $dataSource) {
                 $dataSrcCredential = new DataSourceCredentials();
                 $dataSrcCredential->DataSourceName = $dataSource->dataSourceName;
                 $dataSrcCredential->UserName = $dataSource->userName;
                 $dataSrcCredential->Password = $dataSource->password;
                 $dataSrcCredentials[] = $dataSrcCredential;
             }
             $ssrsReport->SetExecutionCredentials2($dataSrcCredentials);
         }
         $renderAsHTML = new renderAsHTML();
         try {
             $result = $ssrsReport->Render2($renderAsHTML, PageCountModeEnum::$Estimate, $Extension, $MimeType, $Encoding, $Warnings, $StreamIds);
         } catch (SSRSReportException $exception) {
             if ($exception->errorCode == 'rsProcessingAborted') {
                 throw new SSRSReportException(null, 'The provided data source credentials are not valid', null);
             }
             throw new SSRSReportException($exception->errorCode, $exception->errorDescription, $exception->soapFault);
         }
         echo "\n Test Connection Succeeded!!\n\n";
     } catch (SSRSReportException $exception) {
         $errorMessage = $exception->GetErrorMessage();
         $errorMessage = str_replace("<br/>", "\n", $errorMessage);
         echo $errorMessage;
         echo "\n\n";
         $this->ShowUsage();
     }
 }