Пример #1
0
         $Modifier = '';
     }
     $strQuery1 = "INSERT INTO ar_session (payer_id,user_id,reference,check_date,deposit_date,pay_total," . " global_amount,payment_type,description,patient_id,payment_method,adjustment_code,post_to_date) " . " VALUES ('0',?,?,now(),now(),?,'','patient','COPAY',?,?,'patient_payment',now())";
     $session_id = idSqlStatement($strQuery1, array($userId, $check_ref_number, $amount, $patient_id, $payment_type));
     $insert_id = idSqlStatement("INSERT INTO ar_activity (pid,encounter,code_type,code,modifier,payer_type,post_time,post_user,session_id,pay_amount,account_code)" . " VALUES (?,?,?,?,?,0,now(),?,?,?,'PCP')", array($patient_id, $visit_id, $Codetype, $Code, $Modifier, $userId, $session_id, $amount));
     $result = frontPayment($patient_id, $visit_id, $payment_type, $payment_method, $amount, 0, $timestamp, $user);
 }
 if ($payment_type == 'invoice_balance' || $payment_type == 'cash') {
     if ($payment_type == 'cash') {
         sqlStatement("update form_encounter set last_level_closed=? where encounter=? and pid=? ", array(4, $visit_id, $patient_id));
         sqlStatement("update billing set billed=? where encounter=? and pid=?", array(1, $visit_id, $patient_id));
     }
     $adjustment_code = 'patient_payment';
     $strQuery2 = "insert into ar_session set " . "payer_id = ?" . ", patient_id = ?" . ", user_id = ?" . ", closed = ?" . ", reference = ?" . ", check_date =  now() , deposit_date = now() " . ", pay_total = ?" . ", payment_type = 'patient'" . ", description = ?" . ", adjustment_code = ?" . ", post_to_date = now() " . ", payment_method = ?";
     $payment_id = idSqlStatement($strQuery2, array(0, $patient_id, $userId, 0, $check_ref_number, $amount, $NameNew, $adjustment_code, $payment_type));
     $result = frontPayment($patient_id, $visit_id, $payment_type, $payment_method, 0, $amount, $timestamp, $user);
     //insertion to 'payments' table.
     $resMoneyGot = sqlStatement("SELECT sum(pay_amount) as PatientPay FROM ar_activity where pid =? and " . "encounter =? and payer_type=0 and account_code='PCP'", array($patient_id, $visit_id));
     //new fees screen copay gives account_code='PCP'
     $rowMoneyGot = sqlFetchArray($resMoneyGot);
     $Copay = $rowMoneyGot['PatientPay'];
     $ResultSearchNew = sqlStatement("SELECT * FROM billing LEFT JOIN code_types ON billing.code_type=code_types.ct_key WHERE code_types.ct_fee=1 " . "AND billing.activity!=0 AND billing.pid =? AND encounter=? ORDER BY billing.code,billing.modifier", array($patient_id, $visit_id));
     while ($RowSearch = sqlFetchArray($ResultSearchNew)) {
         $Codetype = $RowSearch['code_type'];
         $Code = $RowSearch['code'];
         $Modifier = $RowSearch['modifier'];
         $Fee = $RowSearch['fee'];
         $resMoneyGot = sqlStatement("SELECT sum(pay_amount) as MoneyGot FROM ar_activity where pid =? " . "and code_type=? and code=? and modifier=? and encounter =? and !(payer_type=0 and account_code='PCP')", array($patient_id, $Codetype, $Code, $Modifier, $visit_id));
         $rowMoneyGot = sqlFetchArray($resMoneyGot);
         $MoneyGot = $rowMoneyGot['MoneyGot'];
         $resMoneyAdjusted = sqlStatement("SELECT sum(adj_amount) as MoneyAdjusted FROM ar_activity where " . "pid =? and code_type=? and code=? and modifier=? and encounter =?", array($patient_id, $Codetype, $Code, $Modifier, $visit_id));
Пример #2
0
 if ($_REQUEST['radio_type_of_payment'] == 'copay') {
     $session_id = idSqlStatement("INSERT INTO ar_session (payer_id,user_id,reference,check_date,deposit_date,pay_total," . " global_amount,payment_type,description,patient_id,payment_method,adjustment_code,post_to_date) " . " VALUES ('0',?,?,now(),now(),?,'','patient','COPAY',?,?,'patient_payment',now())", array($_SESSION['authId'], $form_source, $amount, $form_pid, $form_method));
     $insrt_id = idSqlStatement("INSERT INTO ar_activity (pid,encounter,code,modifier,payer_type,post_time,post_user,session_id,pay_amount,account_code)" . " VALUES (?,?,?,?,0,now(),?,?,?,'PCP')", array($form_pid, $enc, $Code, $Modifier, $_SESSION['authId'], $session_id, $amount));
     frontPayment($form_pid, $enc, $form_method, $form_source, $amount, 0);
     //insertion to 'payments' table.
 }
 if ($_REQUEST['radio_type_of_payment'] == 'invoice_balance' || $_REQUEST['radio_type_of_payment'] == 'cash') {
     //Payment by patient after insurance paid, cash patients similar to do not bill insurance in feesheet.
     if ($_REQUEST['radio_type_of_payment'] == 'cash') {
         sqlStatement("update form_encounter set last_level_closed=? where encounter=? and pid=? ", array(4, $enc, $form_pid));
         sqlStatement("update billing set billed=? where encounter=? and pid=?", array(1, $enc, $form_pid));
     }
     $adjustment_code = 'patient_payment';
     $payment_id = idSqlStatement("insert into ar_session set " . "payer_id = ?" . ", patient_id = ?" . ", user_id = ?" . ", closed = ?" . ", reference = ?" . ", check_date =  now() , deposit_date = now() " . ",  pay_total = ?" . ", payment_type = 'patient'" . ", description = ?" . ", adjustment_code = ?" . ", post_to_date = now() " . ", payment_method = ?", array(0, $form_pid, $_SESSION['authUserID'], 0, $form_source, $amount, $NameNew, $adjustment_code, $form_method));
     //--------------------------------------------------------------------------------------------------------------------
     frontPayment($form_pid, $enc, $form_method, $form_source, 0, $amount);
     //insertion to 'payments' table.
     //--------------------------------------------------------------------------------------------------------------------
     $resMoneyGot = sqlStatement("SELECT sum(pay_amount) as PatientPay FROM ar_activity where pid =? and " . "encounter =? and payer_type=0 and account_code='PCP'", array($form_pid, $enc));
     //new fees screen copay gives account_code='PCP'
     $rowMoneyGot = sqlFetchArray($resMoneyGot);
     $Copay = $rowMoneyGot['PatientPay'];
     //--------------------------------------------------------------------------------------------------------------------
     //Looping the existing code and modifier
     $ResultSearchNew = sqlStatement("SELECT * FROM billing LEFT JOIN code_types ON billing.code_type=code_types.ct_key WHERE code_types.ct_fee=1 " . "AND billing.activity!=0 AND billing.pid =? AND encounter=? ORDER BY billing.code,billing.modifier", array($form_pid, $enc));
     while ($RowSearch = sqlFetchArray($ResultSearchNew)) {
         $Code = $RowSearch['code'];
         $Modifier = $RowSearch['modifier'];
         $Fee = $RowSearch['fee'];
         $resMoneyGot = sqlStatement("SELECT sum(pay_amount) as MoneyGot FROM ar_activity where pid =? " . "and code=? and modifier=? and encounter =? and !(payer_type=0 and account_code='PCP')", array($form_pid, $Code, $Modifier, $enc));
         //new fees screen copay gives account_code='PCP'
Пример #3
0
 if ($_REQUEST['radio_type_of_payment'] == 'copay') {
     $session_id = idSqlStatement("INSERT INTO ar_session (payer_id,user_id,reference,check_date,deposit_date,pay_total," . " global_amount,payment_type,description,patient_id,payment_method,adjustment_code,post_to_date) " . " VALUES ('0',?,?,now(),now(),?,'','patient','COPAY',?,?,'patient_payment',now())", array($_SESSION['authId'], $form_source, $amount, $form_pid, $form_method));
     $insrt_id = idSqlStatement("INSERT INTO ar_activity (pid,encounter,code_type,code,modifier,payer_type,post_time,post_user,session_id,pay_amount,account_code)" . " VALUES (?,?,?,?,?,0,now(),?,?,?,'PCP')", array($form_pid, $enc, $Codetype, $Code, $Modifier, $_SESSION['authId'], $session_id, $amount));
     frontPayment($form_pid, $enc, $form_method, $form_source, $amount, 0, $timestamp);
     //insertion to 'payments' table.
 }
 if ($_REQUEST['radio_type_of_payment'] == 'invoice_balance' || $_REQUEST['radio_type_of_payment'] == 'cash') {
     //Payment by patient after insurance paid, cash patients similar to do not bill insurance in feesheet.
     if ($_REQUEST['radio_type_of_payment'] == 'cash') {
         sqlStatement("update form_encounter set last_level_closed=? where encounter=? and pid=? ", array(4, $enc, $form_pid));
         sqlStatement("update billing set billed=? where encounter=? and pid=?", array(1, $enc, $form_pid));
     }
     $adjustment_code = 'patient_payment';
     $payment_id = idSqlStatement("insert into ar_session set " . "payer_id = ?" . ", patient_id = ?" . ", user_id = ?" . ", closed = ?" . ", reference = ?" . ", check_date =  now() , deposit_date = now() " . ",  pay_total = ?" . ", payment_type = 'patient'" . ", description = ?" . ", adjustment_code = ?" . ", post_to_date = now() " . ", payment_method = ?", array(0, $form_pid, $_SESSION['authUserID'], 0, $form_source, $amount, $NameNew, $adjustment_code, $form_method));
     //--------------------------------------------------------------------------------------------------------------------
     frontPayment($form_pid, $enc, $form_method, $form_source, 0, $amount, $timestamp);
     //insertion to 'payments' table.
     //--------------------------------------------------------------------------------------------------------------------
     $resMoneyGot = sqlStatement("SELECT sum(pay_amount) as PatientPay FROM ar_activity where pid =? and " . "encounter =? and payer_type=0 and account_code='PCP'", array($form_pid, $enc));
     //new fees screen copay gives account_code='PCP'
     $rowMoneyGot = sqlFetchArray($resMoneyGot);
     $Copay = $rowMoneyGot['PatientPay'];
     //--------------------------------------------------------------------------------------------------------------------
     //Looping the existing code and modifier
     $ResultSearchNew = sqlStatement("SELECT * FROM billing LEFT JOIN code_types ON billing.code_type=code_types.ct_key WHERE code_types.ct_fee=1 " . "AND billing.activity!=0 AND billing.pid =? AND encounter=? ORDER BY billing.code,billing.modifier", array($form_pid, $enc));
     while ($RowSearch = sqlFetchArray($ResultSearchNew)) {
         $Codetype = $RowSearch['code_type'];
         $Code = $RowSearch['code'];
         $Modifier = $RowSearch['modifier'];
         $Fee = $RowSearch['fee'];
         $resMoneyGot = sqlStatement("SELECT sum(pay_amount) as MoneyGot FROM ar_activity where pid =? " . "and code_type=? and code=? and modifier=? and encounter =? and !(payer_type=0 and account_code='PCP')", array($form_pid, $Codetype, $Code, $Modifier, $enc));