Ejemplo n.º 1
0
function echoProdLine($lino, $drug_id, $del = FALSE, $units = NULL, $fee = NULL, $sale_id = 0, $billed = FALSE)
{
    global $code_types, $ndc_applies, $pid, $usbillstyle, $hasCharges;
    $drow = sqlQuery("SELECT name FROM drugs WHERE drug_id = ?", array($drug_id));
    $code_text = $drow['name'];
    $fee = sprintf('%01.2f', $fee);
    if (empty($units)) {
        $units = 1;
    }
    $units = max(1, intval($units));
    // We put unit price on the screen, not the total line item fee.
    $price = $fee / $units;
    $strike1 = $sale_id && $del ? "<strike>" : "";
    $strike2 = $sale_id && $del ? "</strike>" : "";
    echo " <tr>\n";
    echo "  <td class='billcell'>{$strike1}" . xlt("Product") . "{$strike2}";
    echo "<input type='hidden' name='prod[" . attr($lino) . "][sale_id]' value='" . attr($sale_id) . "'>";
    echo "<input type='hidden' name='prod[" . attr($lino) . "][drug_id]' value='" . attr($drug_id) . "'>";
    echo "<input type='hidden' name='prod[" . attr($lino) . "][billed]' value='" . attr($billed) . "'>";
    echo "</td>\n";
    echo "  <td class='billcell'>{$strike1}" . text($drug_id) . "{$strike2}</td>\n";
    if (modifiers_are_used(true)) {
        echo "  <td class='billcell'>&nbsp;</td>\n";
    }
    if ($billed) {
        if (fees_are_used()) {
            echo "  <td class='billcell' align='right'>" . text(oeFormatMoney($price)) . "</td>\n";
            echo "  <td class='billcell' align='center'>" . text($units) . "</td>\n";
        }
        if (justifiers_are_used()) {
            echo "  <td class='billcell' align='center'{$usbillstyle}>&nbsp;</td>\n";
            // justify
        }
        echo "  <td class='billcell' align='center'>&nbsp;</td>\n";
        // provider
        echo "  <td class='billcell' align='center'{$usbillstyle}>&nbsp;</td>\n";
        // note codes
        echo "  <td class='billcell' align='center'{$usbillstyle}>&nbsp;</td>\n";
        // auth
        echo "  <td class='billcell' align='center'><input type='checkbox'" . " disabled /></td>\n";
    } else {
        if (fees_are_used()) {
            echo "  <td class='billcell' align='right'>" . "<input type='text' name='prod[" . attr($lino) . "][price]' " . "value='" . attr($price) . "' size='6'";
            if (acl_check('acct', 'disc')) {
                echo " style='text-align:right'";
            } else {
                echo " style='text-align:right;background-color:transparent' readonly";
            }
            echo "></td>\n";
            echo "  <td class='billcell' align='center'>";
            echo "<input type='text' name='prod[" . attr($lino) . "][units]' " . "value='" . attr($units) . "' size='2' style='text-align:right'>";
            echo "</td>\n";
        }
        if (justifiers_are_used()) {
            echo "  <td class='billcell'{$usbillstyle}>&nbsp;</td>\n";
            // justify
        }
        echo "  <td class='billcell' align='center'>&nbsp;</td>\n";
        // provider
        echo "  <td class='billcell' align='center'{$usbillstyle}>&nbsp;</td>\n";
        // note codes
        echo "  <td class='billcell' align='center'{$usbillstyle}>&nbsp;</td>\n";
        // auth
        echo "  <td class='billcell' align='center'><input type='checkbox' name='prod[" . attr($lino) . "][del]' " . "value='1'" . ($del ? " checked" : "") . " /></td>\n";
    }
    echo "  <td class='billcell'>{$strike1}" . text($code_text) . "{$strike2}</td>\n";
    echo " </tr>\n";
    if ($fee != 0) {
        $hasCharges = true;
    }
}
Ejemplo n.º 2
0
function echoProductLines()
{
    global $code_types, $usbillstyle, $liprovstyle, $justifystyle, $fs, $price_levels_are_used;
    foreach ($fs->productitems as $lino => $li) {
        $drug_id = $li['hidden']['drug_id'];
        $selector = $li['hidden']['selector'];
        $sale_id = $li['hidden']['sale_id'];
        $billed = $li['hidden']['billed'];
        $fee = $li['fee'];
        $price = $li['price'];
        $pricelevel = $li['pricelevel'];
        $units = $li['units'];
        $del = $li['del'];
        $warehouse_id = $li['warehouse'];
        $rx = $li['rx'];
        $strike1 = $sale_id && $del ? "<strike>" : "";
        $strike2 = $sale_id && $del ? "</strike>" : "";
        echo " <tr>\n";
        echo "  <td class='billcell'>{$strike1}" . xlt("Product") . "{$strike2}";
        echo "<input type='hidden' name='prod[" . attr($lino) . "][sale_id]' value='" . attr($sale_id) . "'>";
        echo "<input type='hidden' name='prod[" . attr($lino) . "][drug_id]' value='" . attr($drug_id) . "'>";
        echo "<input type='hidden' name='prod[" . attr($lino) . "][selector]' value='" . attr($selector) . "'>";
        echo "<input type='hidden' name='prod[" . attr($lino) . "][billed]' value='" . attr($billed) . "'>";
        if (isset($li['hidden']['method'])) {
            echo "<input type='hidden' name='prod[{$lino}][method]' value='" . attr($li['hidden']['method']) . "' />";
            echo "<input type='hidden' name='prod[{$lino}][methtype]' value='" . attr($li['hidden']['methtype']) . "' />";
        }
        echo "</td>\n";
        echo "  <td class='billcell'>{$strike1}" . text($drug_id) . "{$strike2}</td>\n";
        echo "  <td class='billcell'>{$strike1}" . text($li['code_text']) . "{$strike2}</td>\n";
        if (modifiers_are_used(true)) {
            echo "  <td class='billcell'>&nbsp;</td>\n";
        }
        if ($billed) {
            if (fees_are_used()) {
                if ($price_levels_are_used) {
                    echo "  <td class='billcell' align='center'>";
                    echo $fs->genPriceLevelSelect('', ' ', $drug_id, $selector, $pricelevel, true);
                    echo "</td>\n";
                }
                echo "  <td class='billcell' align='right'>" . text(oeFormatMoney($price)) . "</td>\n";
                echo "  <td class='billcell' align='center'>" . text($units) . "</td>\n";
            }
            if (justifiers_are_used()) {
                // KHY Evaluate proper position/usage of if justifiers
                echo "  <td class='billcell' align='center'{$justifystyle}>&nbsp;</td>\n";
                // justify
            }
            // Show warehouse for this line.
            echo "  <td class='billcell' align='center' {$liprovstyle}>";
            echo $fs->genWarehouseSelect('', ' ', $warehouse_id, true, $drug_id, $sale_id > 0);
            echo "</td>\n";
            //
            echo "  <td class='billcell' align='center'{$usbillstyle}>&nbsp;</td>\n";
            // note codes
            echo "  <td class='billcell' align='center'{$usbillstyle}>&nbsp;</td>\n";
            // auth
            if ($GLOBALS['gbl_auto_create_rx']) {
                echo "  <td class='billcell' align='center'><input type='checkbox'" . " disabled /></td>\n";
            }
            echo "  <td class='billcell' align='center'><input type='checkbox'" . " disabled /></td>\n";
        } else {
            // not billed
            if (fees_are_used()) {
                if ($price_levels_are_used) {
                    echo "  <td class='billcell' align='center'>";
                    echo $fs->genPriceLevelSelect("prod[{$lino}][pricelevel]", ' ', $drug_id, $selector, $pricelevel);
                    echo "</td>\n";
                }
                echo "  <td class='billcell' align='right'>" . "<input type='text' name='prod[" . attr($lino) . "][price]' " . "value='" . attr($price) . "' size='6' onchange='setSaveAndClose()'";
                if (acl_check('acct', 'disc')) {
                    echo " style='text-align:right'";
                } else {
                    echo " style='text-align:right;background-color:transparent' readonly";
                }
                echo "></td>\n";
                echo "  <td class='billcell' align='center'>";
                echo "<input type='text' name='prod[" . attr($lino) . "][units]' " . "value='" . attr($units) . "' size='2' style='text-align:right'>";
                echo "</td>\n";
            }
            if (justifiers_are_used()) {
                echo "  <td class='billcell'{$justifystyle}>&nbsp;</td>\n";
                // justify
            }
            // Generate warehouse selector if there is a choice of warehouses.
            echo "  <td class='billcell' align='center' {$liprovstyle}>";
            echo $fs->genWarehouseSelect("prod[{$lino}][warehouse]", ' ', $warehouse_id, false, $drug_id, $sale_id > 0);
            echo "</td>\n";
            //
            echo "  <td class='billcell' align='center'{$usbillstyle}>&nbsp;</td>\n";
            // note codes
            echo "  <td class='billcell' align='center'{$usbillstyle}>&nbsp;</td>\n";
            // auth
            if ($GLOBALS['gbl_auto_create_rx']) {
                echo "  <td class='billcell' align='center'>" . "<input type='checkbox' name='prod[{$lino}][rx]' value='1'" . ($rx ? " checked" : "") . " /></td>\n";
            }
            echo "  <td class='billcell' align='center'><input type='checkbox' name='prod[" . attr($lino) . "][del]' " . "value='1'" . ($del ? " checked" : "") . " /></td>\n";
        }
        echo " </tr>\n";
    }
}