Пример #1
0
 * 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;
        }
        fclose($handle);
        echo "<script type='text/javascript'>alert('Report {$saveName} exported'); window.location = 'GetReports.php';</script>";
    }
    echo "<script type='text/javascript'>alert('Export failed'); window.location = 'GetReports.php';</script>";
} catch (SSRSReportException $serviceExcprion) {
    echo "\n<br/>" . $serviceExcprion->GetErrorMessage();
Пример #2
0
     $parameters[3]->Name = "ProductSubcategory";
     $parameters[3]->Value = "2";
     $rs->SetExecutionParameters2($parameters);
 }
 $renderAsHTML = new RenderAsHTML();
 //The ReplcementRoot option of HTML rendering extension is used to
 //redirect all calls to reporting serice server to this php file.
 //The StreamRoot option of HTML rendering extension used instruct
 //HTML rendering extension about how to construct the URLs to images in the
 //report.
 //Please refer description of Sort2, Render2 and RenderStream API in
 //the userguide (./../../../docs/User Guide.html) for more details
 //about these options.
 $renderAsHTML->ReplacementRoot = getPageURL();
 $renderAsHTML->StreamRoot = './images/';
 $result_html = $rs->Render2($renderAsHTML, PageCountModeEnum::$Actual, $Extension, $MimeType, $Encoding, $Warnings, $StreamIds);
 foreach ($StreamIds as $StreamId) {
     $renderAsHTML->StreamRoot = null;
     $result_png = $rs->RenderStream($renderAsHTML, $StreamId, $Encoding, $MimeType);
     if (!($handle = fopen("./images/" . $StreamId, 'wb'))) {
         echo "Cannot open file for writing output";
         exit;
     }
     if (fwrite($handle, $result_png) === FALSE) {
         echo "Cannot write to file";
         exit;
     }
     fclose($handle);
 }
 echo '<html><body><br/><br/>';
 echo '<div align="center">';
Пример #3
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;
 }
 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();
     }
 }