本文整理汇总了PHP中SLRowCount函数的典型用法代码示例。如果您正苦于以下问题:PHP SLRowCount函数的具体用法?PHP SLRowCount怎么用?PHP SLRowCount使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了SLRowCount函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: SLQuery
$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']);
// Under some conditions we may skip invoices that matched the SQL query.
//
if ($row['trans_id'] == $last_trans_id) {
if ($skipping) {
continue;
}
// same invoice and not skipping, do nothing.
} else {
// new invoice
$skipping = false;
// If a diagnosis code was given then skip any invoices without
// that diagnosis.
if ($form_icdcode) {
示例2: 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() {
//.........这里部分代码省略.........
示例3: get_invoice_summary
function get_invoice_summary($trans_id, $with_detail = false)
{
global $sl_err, $sl_cash_acc;
$codes = array();
$chart_id_cash = SLQueryValue("select id from chart where accno = '{$sl_cash_acc}'");
if ($sl_err) {
die($sl_err);
}
if (!$chart_id_cash) {
die("There is no COA entry for cash account '{$sl_cash_acc}'");
}
// Request all cash entries belonging to the invoice.
$atres = SLQuery("select * from acc_trans where trans_id = {$trans_id} and chart_id = {$chart_id_cash}");
if ($sl_err) {
die($sl_err);
}
// Deduct payments for each procedure code from the respective balance owed.
$keysuffix = 5000;
for ($irow = 0; $irow < SLRowCount($atres); ++$irow) {
$row = SLGetRow($atres, $irow);
$code = strtoupper($row['memo']);
$ins_id = $row['project_id'];
if (!$code) {
$code = "Unknown";
}
$amount = $row['amount'];
$codes[$code]['bal'] += $amount;
// amount is negative for a payment
if ($ins_id) {
$codes[$code]['ins'] = $ins_id;
}
// Add the details if they want 'em.
if ($with_detail) {
if (!$codes[$code]['dtl']) {
$codes[$code]['dtl'] = array();
}
$tmpkey = $row['transdate'] . $keysuffix++;
$tmp = array();
$tmp['pmt'] = 0 - $amount;
$tmp['src'] = $row['source'];
if ($ins_id) {
$tmp['ins'] = $ins_id;
}
$codes[$code]['dtl'][$tmpkey] = $tmp;
}
}
// Request all line items with money or adjustment reasons belonging
// to the invoice.
$inres = SLQuery("SELECT * FROM invoice WHERE trans_id = {$trans_id} AND " . "( sellprice != 0 OR description LIKE 'Adjustment%' OR serialnumber = 'Claim' )");
if ($sl_err) {
die($sl_err);
}
// Add charges and adjustments for each procedure code into its total and balance.
$keysuffix = 1000;
for ($irow = 0; $irow < SLRowCount($inres); ++$irow) {
$row = SLGetRow($inres, $irow);
// $amount = $row['sellprice'];
$amount = sprintf('%01.2f', $row['sellprice'] * $row['qty']);
$ins_id = $row['project_id'];
$code = "Unknown";
if ($row['serialnumber'] == 'Claim') {
$code = 'Claim';
} else {
if (preg_match("/([A-Za-z0-9]\\d\\d\\S*)/", $row['serialnumber'], $matches)) {
$code = strtoupper($matches[1]);
} else {
if (preg_match("/([A-Za-z0-9]\\d\\d\\S*)/", $row['description'], $matches)) {
$code = strtoupper($matches[1]);
} else {
if (preg_match("/^TAX:/", $row['description'])) {
$code = 'TAX';
}
}
}
}
$codes[$code]['chg'] += $amount;
$codes[$code]['bal'] += $amount;
if ($amount < 0) {
$codes[$code]['adj'] -= $amount;
}
if ($ins_id) {
$codes[$code]['ins'] = $ins_id;
}
// Add the details if they want 'em.
if ($with_detail) {
if (!$codes[$code]['dtl']) {
$codes[$code]['dtl'] = array();
}
if (preg_match("/^Adjustment\\s*(\\S*)\\s*(.*)/", $row['description'], $matches)) {
$tmpkey = str_pad($matches[1], 10) . $keysuffix++;
$tmp = array();
$tmp['chg'] = $amount;
$tmp['rsn'] = $matches[2];
if ($ins_id) {
$tmp['ins'] = $ins_id;
}
$codes[$code]['dtl'][$tmpkey] = $tmp;
} else {
$tmpkey = " " . $keysuffix++;
$tmp = array();
//.........这里部分代码省略.........
示例4: SUM
$query .= "substring(trim(both from customer.name) from '% #\"%#\"' for '#') AS lname, " . "substring(trim(both from customer.name) from '#\"%#\" %' for '#') AS fname, ";
}
$query .= "(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 " . "FROM ar, customer WHERE ( {$where} ) AND customer.id = ar.customer_id ";
if ($_POST['form_category'] != 'All' && !$eracount) {
$query .= "AND ar.amount != ar.paid ";
// if ($_POST['form_category'] == 'Due') {
// $query .= "AND ar.duedate <= CURRENT_DATE ";
// }
}
$query .= "ORDER BY lname, fname, ar.invnumber";
// echo "<!-- $query -->\n"; // debugging
$t_res = SLQuery($query);
if ($sl_err) {
die($sl_err);
}
$num_invoices = SLRowCount($t_res);
if ($eracount && $num_invoices != $eracount) {
$alertmsg .= "Of {$eracount} remittances, there are {$num_invoices} " . "matching claims in OpenEMR. ";
}
}
// end not $INTEGRATED_AR
?>
<table border='0' cellpadding='1' cellspacing='2' width='98%'>
<tr bgcolor="#dddddd">
<td class="dehead">
<?php
xl('Patient', 'e');
?>
</td>
示例5: sqlQuery
$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']);
$inseobs = strtolower($irow['shipvia']);
foreach (array('ins1', 'ins2', 'ins3') as $value) {
if (strpos($insgot, $value) !== false && strpos($inseobs, $value) === false) {
--$duncount;
示例6: slSetupSecondary
//.........这里部分代码省略.........
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
// its associated icd9 code.
$inres = SLQuery("SELECT * FROM invoice WHERE trans_id = {$invid} " . "ORDER BY id");
if ($sl_err) {
die($sl_err);
}
// When nonzero, this will be the ID of a billing row that needs to
// have its justify field set.
$proc_ins_id = 0;
for ($irow = 0; $irow < SLRowCount($inres); ++$irow) {
$row = SLGetRow($inres, $irow);
$amount = sprintf('%01.2f', $row['sellprice'] * $row['qty']);
// Extract the billing code.
$code = xl("Unknown");
if (preg_match("/([A-Za-z0-9]\\d\\d\\S*)/", $row['serialnumber'], $matches)) {
$code = strtoupper($matches[1]);
} else {
if (preg_match("/([A-Za-z0-9]\\d\\d\\S*)/", $row['description'], $matches)) {
$code = strtoupper($matches[1]);
}
}
list($code, $modifier) = explode("-", $code);
// Set the billing code type and description.
$code_type = "";
$code_text = "";
foreach ($code_types as $key => $value) {
if (preg_match("/{$key}/", $row['serialnumber'])) {
$code_type = $key;
if ($value['fee']) {
$code_text = xl("Procedure") . " {$code}";
} else {
$code_text = xl("Diagnosis") . " {$code}";
if ($proc_ins_id) {
$query = "UPDATE billing SET justify = '{$code}' WHERE id = {$proc_ins_id}";
if ($debug) {
echo $query . "<br>\n";
} else {
sqlQuery($query);
}
$proc_ins_id = 0;
}
}
示例7: sqlQuery
$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";
?>
<tr bgcolor='<?php
echo $bgcolor;
?>
'>