当前位置: 首页>>代码示例>>PHP>>正文


PHP SLQuery函数代码示例

本文整理汇总了PHP中SLQuery函数的典型用法代码示例。如果您正苦于以下问题:PHP SLQuery函数的具体用法?PHP SLQuery怎么用?PHP SLQuery使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了SLQuery函数的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: generate_receipt

function generate_receipt($patient_id, $encounter = 0)
{
    global $sl_err, $sl_cash_acc, $css_header, $details, $INTEGRATED_AR;
    // Get details for what we guess is the primary facility.
    $frow = sqlQuery("SELECT * FROM facility " . "ORDER BY billing_location DESC, accepts_assignment DESC, id LIMIT 1");
    $patdata = getPatientData($patient_id, 'fname,mname,lname,pubpid,street,city,state,postal_code,providerID');
    // Get the most recent invoice data or that for the specified encounter.
    //
    // Adding a provider check so that their info can be displayed on receipts
    if ($INTEGRATED_AR) {
        if ($encounter) {
            $ferow = sqlQuery("SELECT id, date, encounter, provider_id FROM form_encounter " . "WHERE pid = ? AND encounter = ?", array($patient_id, $encounter));
        } else {
            $ferow = sqlQuery("SELECT id, date, encounter, provider_id FROM form_encounter " . "WHERE pid = ? " . "ORDER BY id DESC LIMIT 1", array($patient_id));
        }
        if (empty($ferow)) {
            die(xlt("This patient has no activity."));
        }
        $trans_id = $ferow['id'];
        $encounter = $ferow['encounter'];
        $svcdate = substr($ferow['date'], 0, 10);
        if ($GLOBALS['receipts_by_provider']) {
            if (isset($ferow['provider_id'])) {
                $encprovider = $ferow['provider_id'];
            } else {
                if (isset($patdata['providerID'])) {
                    $encprovider = $patdata['providerID'];
                } else {
                    $encprovider = -1;
                }
            }
        }
        if ($encprovider) {
            $providerrow = sqlQuery("SELECT fname, mname, lname, title, street, streetb, " . "city, state, zip, phone, fax FROM users WHERE id = ?", array($encprovider));
        }
    } else {
        SLConnect();
        //
        $arres = SLQuery("SELECT * FROM ar WHERE " . "invnumber LIKE '{$patient_id}.%' " . "ORDER BY id DESC LIMIT 1");
        if ($sl_err) {
            die(text($sl_err));
        }
        if (!SLRowCount($arres)) {
            die(xlt("This patient has no activity."));
        }
        $arrow = SLGetRow($arres, 0);
        //
        $trans_id = $arrow['id'];
        //
        // Determine the date of service.  An 8-digit encounter number is
        // presumed to be a date of service imported during conversion or
        // associated with prescriptions only.  Otherwise look it up in the
        // form_encounter table.
        //
        $svcdate = "";
        list($trash, $encounter) = explode(".", $arrow['invnumber']);
        if (strlen($encounter) >= 8) {
            $svcdate = substr($encounter, 0, 4) . "-" . substr($encounter, 4, 2) . "-" . substr($encounter, 6, 2);
        } else {
            if ($encounter) {
                $tmp = sqlQuery("SELECT date FROM form_encounter WHERE " . "encounter = ?", array($encounter));
                $svcdate = substr($tmp['date'], 0, 10);
            }
        }
    }
    // end not $INTEGRATED_AR
    // Get invoice reference number.
    $encrow = sqlQuery("SELECT invoice_refno FROM form_encounter WHERE " . "pid = ? AND encounter = ? LIMIT 1", array($patient_id, $encounter));
    $invoice_refno = $encrow['invoice_refno'];
    ?>
<html>
<head>
<?php 
    html_header_show();
    ?>
<link rel='stylesheet' href='<?php 
    echo $css_header;
    ?>
' type='text/css'>
<title><?php 
    echo xlt('Receipt for Payment');
    ?>
</title>
<script type="text/javascript" src="../../library/dialog.js"></script>
<script language="JavaScript">

<?php 
    require $GLOBALS['srcdir'] . "/restoreSession.php";
    ?>

 // Process click on Print button.
 function printme() {
  var divstyle = document.getElementById('hideonprint').style;
  divstyle.display = 'none';
  window.print();
  return false;
 }

 // Process click on Delete button.
 function deleteme() {
//.........这里部分代码省略.........
开发者ID:nitinkunte,项目名称:openemr,代码行数:101,代码来源:pos_checkout.php

示例2: responsible_party

function responsible_party($trans_id)
{
    global $sl_err;
    $arres = SLQuery("select * from ar where id = {$trans_id}");
    if ($sl_err) {
        die($sl_err);
    }
    $arrow = SLGetRow($arres, 0);
    if (!$arrow) {
        die(xl("There is no match for invoice id = ") . $trans_id);
    }
    if ($arrow['paid'] >= $arrow['netamount']) {
        return -1;
    }
    $insgot = strtolower($arrow['notes']);
    $insdone = strtolower($arrow['shipvia']);
    for ($i = 1; $i <= 3; ++$i) {
        $lcvalue = "ins{$i}";
        if (strpos($insgot, $lcvalue) !== false && strpos($insdone, $lcvalue) === false) {
            return $i;
        }
    }
    return 0;
}
开发者ID:robonology,项目名称:openemr,代码行数:24,代码来源:invoice_summary.inc.php

示例3: SLQuery

     }
     // end while
 } else {
     if ($form_cptcode) {
         $query = "SELECT acc_trans.amount, acc_trans.transdate, " . "acc_trans.memo, acc_trans.project_id, acc_trans.trans_id, " . "ar.invnumber, ar.employee_id, invoice.sellprice, invoice.qty " . "FROM acc_trans, ar, invoice WHERE " . "acc_trans.chart_id = {$chart_id_cash} AND " . "acc_trans.memo ILIKE '{$form_cptcode}' AND " . "ar.id = acc_trans.trans_id AND " . "invoice.trans_id = acc_trans.trans_id AND " . "invoice.serialnumber ILIKE acc_trans.memo AND " . "invoice.sellprice >= 0.00 AND " . "( invoice.description ILIKE 'CPT%' OR invoice.description ILIKE 'Proc%' ) AND ";
     } else {
         $query = "select acc_trans.amount, acc_trans.transdate, " . "acc_trans.memo, acc_trans.trans_id, " . "ar.invnumber, ar.employee_id from acc_trans, ar where " . "acc_trans.chart_id = {$chart_id_cash} and " . "ar.id = acc_trans.trans_id and ";
     }
     if ($form_use_edate) {
         $query .= "ar.transdate >= '{$form_from_date}' and " . "ar.transdate <= '{$form_to_date}'";
     } else {
         $query .= "acc_trans.transdate >= '{$form_from_date}' and " . "acc_trans.transdate <= '{$form_to_date}'";
     }
     $query .= " order by ar.invnumber";
     // echo "<!-- $query -->\n"; // debugging
     $t_res = SLQuery($query);
     if ($sl_err) {
         die($sl_err);
     }
     $docname = "";
     $docnameleft = "";
     $main_docid = 0;
     $doctotal1 = 0;
     $grandtotal1 = 0;
     $doctotal2 = 0;
     $grandtotal2 = 0;
     $last_trans_id = 0;
     $skipping = false;
     for ($irow = 0; $irow < SLRowCount($t_res); ++$irow) {
         $row = SLGetRow($t_res, $irow);
         list($patient_id, $encounter_id) = explode(".", $row['invnumber']);
开发者ID:stephen-smith,项目名称:openemr,代码行数:31,代码来源:sl_receipts_report.php

示例4: era_callback

function era_callback(&$out)
{
    global $encount, $debug, $claim_status_codes, $adjustment_reasons, $remark_codes;
    global $invoice_total, $last_code, $paydate, $INTEGRATED_AR;
    global $InsertionId;
    //last inserted ID of
    // Some heading information.
    $chk_123 = $out['check_number'];
    $chk_123 = str_replace(' ', '_', $chk_123);
    if (isset($_REQUEST['chk' . $chk_123])) {
        if ($encount == 0) {
            writeMessageLine('#ffffff', 'infdetail', "Payer: " . htmlspecialchars($out['payer_name'], ENT_QUOTES));
            if ($debug) {
                writeMessageLine('#ffffff', 'infdetail', "WITHOUT UPDATE is selected; no changes will be applied.");
            }
        }
        $last_code = '';
        $invoice_total = 0.0;
        $bgcolor = ++$encount & 1 ? "#ddddff" : "#ffdddd";
        list($pid, $encounter, $invnumber) = slInvoiceNumber($out);
        // Get details, if we have them, for the invoice.
        $inverror = true;
        $codes = array();
        if ($pid && $encounter) {
            // Get invoice data into $arrow or $ferow.
            if ($INTEGRATED_AR) {
                $ferow = sqlQuery("SELECT e.*, p.fname, p.mname, p.lname " . "FROM form_encounter AS e, patient_data AS p WHERE " . "e.pid = '{$pid}' AND e.encounter = '{$encounter}' AND " . "p.pid = e.pid");
                if (empty($ferow)) {
                    $pid = $encounter = 0;
                    $invnumber = $out['our_claim_id'];
                } else {
                    $inverror = false;
                    $codes = ar_get_invoice_summary($pid, $encounter, true);
                    // $svcdate = substr($ferow['date'], 0, 10);
                }
            } else {
                $arres = SLQuery("SELECT ar.id, ar.notes, ar.shipvia, customer.name " . "FROM ar, customer WHERE ar.invnumber = '{$invnumber}' AND " . "customer.id = ar.customer_id");
                if ($sl_err) {
                    die($sl_err);
                }
                $arrow = SLGetRow($arres, 0);
                if ($arrow) {
                    $inverror = false;
                    $codes = get_invoice_summary($arrow['id'], true);
                } else {
                    // oops, no such invoice
                    $pid = $encounter = 0;
                    $invnumber = $out['our_claim_id'];
                }
            }
            // end not internal a/r
        }
        // Show the claim status.
        $csc = $out['claim_status_code'];
        $inslabel = 'Ins1';
        if ($csc == '1' || $csc == '19') {
            $inslabel = 'Ins1';
        }
        if ($csc == '2' || $csc == '20') {
            $inslabel = 'Ins2';
        }
        if ($csc == '3' || $csc == '21') {
            $inslabel = 'Ins3';
        }
        $primary = $inslabel == 'Ins1';
        writeMessageLine($bgcolor, 'infdetail', "Claim status {$csc}: " . $claim_status_codes[$csc]);
        // Show an error message if the claim is missing or already posted.
        if ($inverror) {
            writeMessageLine($bgcolor, 'errdetail', "The following claim is not in our database");
        } else {
            // Skip this test. Claims can get multiple CLPs from the same payer!
            //
            // $insdone = strtolower($arrow['shipvia']);
            // if (strpos($insdone, 'ins1') !== false) {
            //  $inverror = true;
            //  writeMessageLine($bgcolor, 'errdetail',
            //   "Primary insurance EOB was already posted for the following claim");
            // }
        }
        if ($csc == '4') {
            //Denial case, code is stored in the claims table for display in the billing manager screen with reason explained.
            $inverror = true;
            if (!$debug) {
                if ($pid && $encounter) {
                    $code_value = '';
                    foreach ($out['svc'] as $svc) {
                        foreach ($svc['adj'] as $adj) {
                            //Per code and modifier the reason will be showed in the billing manager.
                            $code_value .= $svc['code'] . '_' . $svc['mod'] . '_' . $adj['group_code'] . '_' . $adj['reason_code'] . ',';
                        }
                    }
                    $code_value = substr($code_value, 0, -1);
                    //We store the reason code to display it with description in the billing manager screen.
                    //process_file is used as for the denial case file name will not be there, and extra field(to store reason) can be avoided.
                    updateClaim(true, $pid, $encounter, $_REQUEST['InsId'], substr($inslabel, 3), 7, 0, $code_value);
                }
            }
            writeMessageLine($bgcolor, 'errdetail', "Not posting adjustments for denied claims, please follow up manually!");
        } else {
            if ($csc == '22') {
//.........这里部分代码省略.........
开发者ID:rreddy70,项目名称:openemr,代码行数:101,代码来源:sl_eob_process.php

示例5: sqlQuery

     $duept = 0;
     if ($NumberOfInsurance == 0 || $value['last_level_closed'] == 4 || $NumberOfInsurance == $value['last_level_closed']) {
         //Patient balance
         $brow = sqlQuery("SELECT SUM(fee) AS amount FROM billing WHERE " . "pid = ? and encounter = ? AND activity = 1", array($pid, $enc));
         $srow = sqlQuery("SELECT SUM(fee) AS amount FROM drug_sales WHERE " . "pid = ? and encounter = ? ", array($pid, $enc));
         $drow = sqlQuery("SELECT SUM(pay_amount) AS payments, " . "SUM(adj_amount) AS adjustments FROM ar_activity WHERE " . "pid = ? and encounter = ? ", array($pid, $enc));
         $duept = $brow['amount'] + $srow['amount'] - $drow['payments'] - $drow['adjustments'];
     }
     echoLine("form_upay[{$enc}]", $dispdate, $value['charges'], $dpayment_pat, $dpayment + $dadjustment, $duept, $enc, $inscopay, $patcopay);
 }
 // Now list previously billed visits.
 if ($INTEGRATED_AR) {
 } else {
     // Query for all open invoices.
     $query = "SELECT ar.id, ar.invnumber, ar.amount, ar.paid, " . "ar.intnotes, ar.notes, ar.shipvia, " . "(SELECT SUM(invoice.sellprice * invoice.qty) FROM invoice WHERE " . "invoice.trans_id = ar.id AND invoice.sellprice > 0) AS charges, " . "(SELECT SUM(invoice.sellprice * invoice.qty) FROM invoice WHERE " . "invoice.trans_id = ar.id AND invoice.sellprice < 0) AS adjustments, " . "(SELECT SUM(acc_trans.amount) FROM acc_trans WHERE " . "acc_trans.trans_id = ar.id AND acc_trans.chart_id = ? " . "AND acc_trans.source NOT LIKE 'Ins%') AS ptpayments " . "FROM ar WHERE ar.invnumber LIKE ? AND " . "ar.amount != ar.paid " . "ORDER BY ar.invnumber";
     $ires = SLQuery($query, array($chart_id_cash, $pid . "%"));
     if ($sl_err) {
         die($sl_err);
     }
     $num_invoices = SLRowCount($ires);
     for ($ix = 0; $ix < $num_invoices; ++$ix) {
         $irow = SLGetRow($ires, $ix);
         // Get encounter ID and date of service.
         list($patient_id, $enc) = explode(".", $irow['invnumber']);
         $tmp = sqlQuery("SELECT LEFT(date, 10) AS encdate FROM form_encounter " . "WHERE encounter = ?", array($enc));
         $svcdate = $tmp['encdate'];
         // Compute $duncount as in sl_eob_search.php to determine if
         // this invoice is at patient responsibility.
         $duncount = substr_count(strtolower($irow['intnotes']), "statement sent");
         if (!$duncount) {
             $insgot = strtolower($irow['notes']);
开发者ID:nitinkunte,项目名称:openemr,代码行数:31,代码来源:front_payment.php

示例6: sqlQuery

    exit;
}
if ($INTEGRATED_AR) {
    /*****************************************************************
       $ferow = sqlQuery("SELECT e.*, p.fname, p.mname, p.lname " .
         "FROM form_encounter AS e, patient_data AS p WHERE " .
         "e.pid = '$patient_id' AND e.encounter = '$encounter_id' AND ".
         "p.pid = e.pid");
       if (empty($ferow)) die("There is no encounter $patient_id.$encounter_id.");
       $svcdate = substr($ferow['date'], 0, 10);
       *****************************************************************/
    // Get invoice charge details.
    $codes = ar_get_invoice_summary($patient_id, $encounter_id, true);
} else {
    // Get invoice data into $arrow.
    $arres = SLQuery("select ar.*, customer.name, employee.name as doctor " . "from ar, customer, employee where ar.id = {$trans_id} and " . "customer.id = ar.customer_id and employee.id = ar.employee_id");
    if ($sl_err) {
        die($sl_err);
    }
    $arrow = SLGetRow($arres, 0);
    if (!$arrow) {
        die(xl("There is no match for invoice id = ") . $trans_id);
    }
    //
    // Determine the date of service.  An 8-digit encounter number is
    // presumed to be a date of service imported during conversion.
    // Otherwise look it up in the form_encounter table.
    //
    $svcdate = "";
    list($patient_id, $encounter) = explode(".", $arrow['invnumber']);
    if (strlen($encounter) == 8) {
开发者ID:robonology,项目名称:openemr,代码行数:31,代码来源:sl_eob_invoice.php

示例7: slSetupSecondary

function slSetupSecondary($invid, $debug)
{
    global $sl_err, $GLOBALS;
    if ($GLOBALS['oer_config']['ws_accounting']['enabled'] === 2) {
        die("Internal error calling slSetupSecondary()");
    }
    $info_msg = '';
    // Get some needed items from the SQL-Ledger invoice.
    $arres = SLQuery("select invnumber, transdate, customer_id, employee_id, " . "shipvia from ar where ar.id = {$invid}");
    if ($sl_err) {
        die($sl_err);
    }
    $arrow = SLGetRow($arres, 0);
    if (!$arrow) {
        die(xl('There is no match for invoice id') . ' = ' . "{$trans_id}.");
    }
    $customer_id = $arrow['customer_id'];
    $date_of_service = $arrow['transdate'];
    list($trash, $encounter) = explode(".", $arrow['invnumber']);
    // Get the OpenEMR PID corresponding to the customer.
    $pdrow = sqlQuery("SELECT patient_data.pid " . "FROM integration_mapping, patient_data WHERE " . "integration_mapping.foreign_id = {$customer_id} AND " . "integration_mapping.foreign_table = 'customer' AND " . "patient_data.id = integration_mapping.local_id");
    $pid = $pdrow['pid'];
    if (!$pid) {
        die(xl("Cannot find patient from SQL-Ledger customer id") . " = {$customer_id}.");
    }
    // Determine the ID of the next insurance company (if any) to be billed.
    $new_payer_id = -1;
    $new_payer_type = -1;
    $insdone = strtolower($arrow['shipvia']);
    foreach (array('ins1' => 'primary', 'ins2' => 'secondary', 'ins3' => 'tertiary') as $key => $value) {
        if (strpos($insdone, $key) === false) {
            $nprow = sqlQuery("SELECT provider FROM insurance_data WHERE " . "pid = '{$pid}' AND type = '{$value}' AND date <= '{$date_of_service}' " . "ORDER BY date DESC LIMIT 1");
            if (!empty($nprow['provider'])) {
                $new_payer_id = $nprow['provider'];
                $new_payer_type = substr($key, 3);
            }
            break;
        }
    }
    // Find out if the encounter exists.
    $ferow = sqlQuery("SELECT pid FROM form_encounter WHERE " . "encounter = {$encounter}");
    $encounter_pid = $ferow['pid'];
    // If it exists, just update the billing items.
    if ($encounter_pid) {
        if ($encounter_pid != $pid) {
            die(xl("Expected form_encounter.pid to be ") . $pid . ', ' . xl(' but was ') . $encounter_pid);
        }
        // If there's a payer ID queue it up, otherwise just reopen it.
        if ($new_payer_id > 0) {
            // TBD: implement a default bill_process and target in config.php,
            // it should not really be hard-coded here.
            if (!$debug) {
                updateClaim(true, $pid, $encounter, $new_payer_id, $new_payer_type, 1, 5, '', 'hcfa');
            }
        } else {
            if (!$debug) {
                updateClaim(true, $pid, $encounter, -1, -1, 1, 0, '');
            }
        }
        $info_msg = xl("Encounter ") . $encounter . xl(" is ready for re-billing.");
        return;
    }
    // If we get here then the encounter does not already exist.  This should
    // only happen if A/R was converted from an earlier system.  In this case
    // the encounter ID should be the date of service, and we will create the
    // encounter.
    // If it does not exist then it better be (or start with) a date.
    if (!preg_match("/^20\\d\\d\\d\\d\\d\\d/", $encounter)) {
        die(xl("Internal error: encounter '") . $encounter . xl("' should exist but does not."));
    }
    $employee_id = $arrow['employee_id'];
    // Get the OpenEMR provider info corresponding to the SQL-Ledger salesman.
    $drrow = sqlQuery("SELECT users.id, users.username, users.facility_id " . "FROM integration_mapping, users WHERE " . "integration_mapping.foreign_id = {$employee_id} AND " . "integration_mapping.foreign_table = 'salesman' AND " . "users.id = integration_mapping.local_id");
    $provider_id = $drrow['id'];
    if (!$provider_id) {
        die(xl("Cannot find provider from SQL-Ledger employee = ") . $employee_id);
    }
    if (!$date_of_service) {
        die(xl("Invoice has no date!"));
    }
    // Generate a new encounter number.
    $conn = $GLOBALS['adodb']['db'];
    $new_encounter = $conn->GenID("sequences");
    // Create the "new encounter".
    $encounter_id = 0;
    $query = "INSERT INTO form_encounter ( " . "date, reason, facility_id, pid, encounter, onset_date, provider_id " . ") VALUES ( " . "'{$date_of_service}', " . "'" . xl('Imported from Accounting') . "', " . "'" . addslashes($drrow['facility_id']) . "', " . "{$pid}, " . "{$new_encounter}, " . "'{$date_of_service}', " . "'{$provider_id}' " . ")";
    if ($debug) {
        echo $query . "<br>\n";
        echo xl("Call to addForm() goes here.<br>") . "\n";
    } else {
        $encounter_id = idSqlStatement($query);
        if (!$encounter_id) {
            die(xl("Insert failed: ") . $query);
        }
        addForm($new_encounter, xl("New Patient Encounter"), $encounter_id, "newpatient", $pid, 1, $date_of_service);
        $info_msg = xl("Encounter ") . $new_encounter . xl(" has been created. ");
    }
    // For each invoice line item with a billing code we will insert
    // a billing row with payer_id set to -1.  Order the line items
    // chronologically so that each procedure code will be followed by
//.........这里部分代码省略.........
开发者ID:hompothgyorgy,项目名称:openemr,代码行数:101,代码来源:sl_eob.inc.php

示例8: loadPayerInfo

 function loadPayerInfo(&$billrow)
 {
     global $sl_err;
     $encounter_date = substr($this->encounter['date'], 0, 10);
     // Create the $payers array.  This contains data for all insurances
     // with the current one always at index 0, and the others in payment
     // order starting at index 1.
     //
     $this->payers = array();
     $this->payers[0] = array();
     $query = "SELECT * FROM insurance_data WHERE " . "pid = '{$this->pid}' AND " . "date <= '{$encounter_date}' " . "ORDER BY type ASC, date DESC";
     $dres = sqlStatement($query);
     $prevtype = '';
     while ($drow = sqlFetchArray($dres)) {
         if (strcmp($prevtype, $drow['type']) == 0) {
             continue;
         }
         $prevtype = $drow['type'];
         // Very important to look at entries with a missing provider because
         // they indicate no insurance as of the given date.
         if (empty($drow['provider'])) {
             continue;
         }
         $ins = count($this->payers);
         if ($drow['provider'] == $billrow['payer_id'] && empty($this->payers[0]['data'])) {
             $ins = 0;
         }
         $crow = sqlQuery("SELECT * FROM insurance_companies WHERE " . "id = '" . $drow['provider'] . "'");
         $orow = new InsuranceCompany($drow['provider']);
         $this->payers[$ins] = array();
         $this->payers[$ins]['data'] = $drow;
         $this->payers[$ins]['company'] = $crow;
         $this->payers[$ins]['object'] = $orow;
     }
     // This kludge hands most cases of a rare ambiguous situation, where
     // the primary insurance company is the same as the secondary.  It seems
     // nobody planned for that!
     //
     for ($i = 1; $i < count($this->payers); ++$i) {
         if ($billrow['process_date'] && $this->payers[0]['data']['provider'] == $this->payers[$i]['data']['provider']) {
             $tmp = $this->payers[0];
             $this->payers[0] = $this->payers[$i];
             $this->payers[$i] = $tmp;
         }
     }
     $this->using_modifiers = true;
     // Get payment and adjustment details if there are any previous payers.
     //
     $this->invoice = array();
     if ($this->payerSequence() != 'P') {
         if ($GLOBALS['oer_config']['ws_accounting']['enabled'] === 2) {
             $this->invoice = ar_get_invoice_summary($this->pid, $this->encounter_id, true);
         } else {
             if ($GLOBALS['oer_config']['ws_accounting']['enabled']) {
                 SLConnect();
                 $arres = SLQuery("select id from ar where invnumber = " . "'{$this->pid}.{$this->encounter_id}'");
                 if ($sl_err) {
                     die($sl_err);
                 }
                 $arrow = SLGetRow($arres, 0);
                 if ($arrow) {
                     $this->invoice = get_invoice_summary($arrow['id'], true);
                 }
                 SLClose();
             }
         }
         // Secondary claims might not have modifiers in SQL-Ledger data.
         // In that case, note that we should not try to match on them.
         $this->using_modifiers = false;
         foreach ($this->invoice as $key => $trash) {
             if (strpos($key, ':')) {
                 $this->using_modifiers = true;
             }
         }
     }
 }
开发者ID:ranjanprasad,项目名称:openemr,代码行数:76,代码来源:Claim.class.php

示例9: row_modify

         row_modify("billing", "activity = 0", "pid = '{$patient_id}' AND " . "encounter = '{$encounter_id}' AND " . "code_type = 'COPAY' AND " . "activity = 1");
         sqlStatement("UPDATE form_encounter SET last_level_billed = 0, " . "last_level_closed = 0, stmt_count = 0, last_stmt_date = NULL " . "WHERE pid = '{$patient_id}' AND encounter = '{$encounter_id}'");
     } else {
         slInitialize();
         $trans_id = SLQueryValue("SELECT id FROM ar WHERE ar.invnumber = '{$billing}' LIMIT 1");
         if ($trans_id) {
             newEvent("delete", $_SESSION['authUser'], $_SESSION['authProvider'], 1, "Invoice {$billing} from SQL-Ledger");
             SLQuery("DELETE FROM acc_trans WHERE trans_id = '{$trans_id}'");
             if ($sl_err) {
                 die($sl_err);
             }
             SLQuery("DELETE FROM invoice WHERE trans_id = '{$trans_id}'");
             if ($sl_err) {
                 die($sl_err);
             }
             SLQuery("DELETE FROM ar WHERE id = '{$trans_id}'");
             if ($sl_err) {
                 die($sl_err);
             }
         } else {
             $info_msg .= "Invoice '{$billing}' not found!";
         }
         SLClose();
     }
     sqlStatement("UPDATE drug_sales SET billed = 0 WHERE " . "pid = '{$patient_id}' AND encounter = '{$encounter_id}'");
     updateClaim(true, $patient_id, $encounter_id, -1, -1, 1, 0, '');
     // clears for rebilling
 } else {
     if ($transaction) {
         if (!acl_check('admin', 'super')) {
             die("Not authorized!");
开发者ID:richsiy,项目名称:openemr,代码行数:31,代码来源:deleter.php

示例10: sqlQuery

 $patient_id = $row['pid'];
 $encounter_id = $row['encounter'];
 $invnumber = $row['pid'] . "." . $row['encounter'];
 if ($INTEGRATED_AR) {
     $inv_duedate = '';
     $arow = sqlQuery("SELECT SUM(fee) AS amount FROM drug_sales WHERE " . "pid = '{$patient_id}' AND encounter = '{$encounter_id}'");
     $inv_amount = $arow['amount'];
     $arow = sqlQuery("SELECT SUM(fee) AS amount FROM billing WHERE " . "pid = '{$patient_id}' AND encounter = '{$encounter_id}' AND " . "activity = 1 AND code_type != 'COPAY'");
     $inv_amount += $arow['amount'];
     $arow = sqlQuery("SELECT SUM(fee) AS amount FROM billing WHERE " . "pid = '{$patient_id}' AND encounter = '{$encounter_id}' AND " . "activity = 1 AND code_type = 'COPAY'");
     $inv_paid = 0 - $arow['amount'];
     $arow = sqlQuery("SELECT SUM(pay_amount) AS pay, " . "sum(adj_amount) AS adj FROM ar_activity WHERE " . "pid = '{$patient_id}' AND encounter = '{$encounter_id}'");
     $inv_paid += $arow['pay'];
     $inv_amount -= $arow['adj'];
 } else {
     $ares = SLQuery("SELECT duedate, amount, paid FROM ar WHERE " . "ar.invnumber = '{$invnumber}'");
     if ($sl_err) {
         die($sl_err);
     }
     if (SLRowCount($ares) == 0) {
         continue;
     }
     $arow = SLGetRow($ares, 0);
     $inv_amount = $arow['amount'];
     $inv_paid = $arow['paid'];
     $inv_duedate = $arow['duedate'];
 }
 $total_amount += bucks($inv_amount);
 $total_paid += bucks($inv_paid);
 $bgcolor = $irow & 1 ? "#ffdddd" : "#ddddff";
 ?>
开发者ID:minggLu,项目名称:openemr,代码行数:31,代码来源:indigent_patients_report.php

示例11: SLConnect

<body>
<span class='title'>OpenEMR Conversion from SQL-Ledger</span>
<br><br>
<span class='text'>
<?php 
SLConnect();
echo "<p>Be patient, this will take a while...</p>";
flush();
// This marker will eventually tell us which encounters have no
// matching invoice.
if (!$dry_run) {
    sqlStatement("UPDATE form_encounter SET last_level_billed = -1");
}
$invoice_count = 0;
$activity_count = 0;
$res = SLQuery("SELECT id, invnumber, transdate, shipvia, intnotes " . "FROM ar WHERE invnumber LIKE '%.%' ORDER BY id");
for ($irow = 0; $irow < SLRowCount($res); ++$irow) {
    $row = SLGetRow($res, $irow);
    list($pid, $encounter) = explode(".", $row['invnumber']);
    $tmp = sqlQuery("SELECT count(*) AS count FROM form_encounter WHERE " . "pid = '{$pid}' AND encounter = '{$encounter}'");
    if ($tmp['count'] == 0) {
        echo "SQL-Ledger invoice {$pid}.{$encounter} has no matching encounter " . "and is ignored. This will affect financial reports!<br />\n";
        continue;
    }
    $billing = array();
    $provider_id = 0;
    $last_biller = 0;
    $svcdate = $row['transdate'];
    if (!$dry_run) {
        // Delete any TAX rows from billing for encounters in SQL-Ledger.
        sqlStatement("UPDATE billing SET activity = 0 WHERE " . "pid = '{$pid}' AND encounter = '{$encounter}' AND " . "code_type = 'TAX'");
开发者ID:gidsil,项目名称:openemr,代码行数:31,代码来源:sl_convert.php

示例12: substr

         $svcdate = substr($irow['date'], 0, 10);
         $duncount = $irow['stmt_count'];
         if (!$duncount) {
             for ($i = 1; $i <= 3 && arGetPayerID($irow['pid'], $irow['date'], $i); ++$i) {
             }
             $duncount = $irow['last_level_closed'] + 1 - $i;
         }
         $inspaid = $irow['inspaid'] + $irow['adjustments'];
         $ptpaid = $irow['ptpaid'] - $irow['copays'];
         $duept = $duncount < 0 ? 0 : $balance;
         echoLine("form_bpay[{$enc}]", $svcdate, $irow['charges'] + $irow['sales'], $ptpaid, $inspaid, $duept);
     }
 } else {
     // Query for all open invoices.
     $query = "SELECT ar.id, ar.invnumber, ar.amount, ar.paid, " . "ar.intnotes, ar.notes, ar.shipvia, " . "(SELECT SUM(invoice.sellprice * invoice.qty) FROM invoice WHERE " . "invoice.trans_id = ar.id AND invoice.sellprice > 0) AS charges, " . "(SELECT SUM(invoice.sellprice * invoice.qty) FROM invoice WHERE " . "invoice.trans_id = ar.id AND invoice.sellprice < 0) AS adjustments, " . "(SELECT SUM(acc_trans.amount) FROM acc_trans WHERE " . "acc_trans.trans_id = ar.id AND acc_trans.chart_id = {$chart_id_cash} " . "AND acc_trans.source NOT LIKE 'Ins%') AS ptpayments " . "FROM ar WHERE ar.invnumber LIKE '{$pid}.%' AND " . "ar.amount != ar.paid " . "ORDER BY ar.invnumber";
     $ires = SLQuery($query);
     if ($sl_err) {
         die($sl_err);
     }
     $num_invoices = SLRowCount($ires);
     for ($ix = 0; $ix < $num_invoices; ++$ix) {
         $irow = SLGetRow($ires, $ix);
         // Get encounter ID and date of service.
         list($patient_id, $enc) = explode(".", $irow['invnumber']);
         $tmp = sqlQuery("SELECT LEFT(date, 10) AS encdate FROM form_encounter " . "WHERE encounter = '{$enc}'");
         $svcdate = $tmp['encdate'];
         // Compute $duncount as in sl_eob_search.php to determine if
         // this invoice is at patient responsibility.
         $duncount = substr_count(strtolower($irow['intnotes']), "statement sent");
         if (!$duncount) {
             $insgot = strtolower($irow['notes']);
开发者ID:robonology,项目名称:openemr,代码行数:31,代码来源:front_payment.php


注:本文中的SLQuery函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。