コード例 #1
0
ファイル: json2mysql.php プロジェクト: hunkim/assembly
function readJson($jsonfile, $db)
{
    $str = file_get_contents($jsonfile);
    $json = json_decode($str, true);
    //print_r ($json);
    $bill = new Bill($json);
    //print $bill->toString();
    if ($bill->link_id === "") {
        echo "Bill ID Needed for {$entry}!";
        exit(-1);
    }
    $bill->insert($db);
    // Let's work on the actors
    foreach ($json['proposers'] as $a) {
        $actor = new Actor($a);
        $actor->is_proposer = 1;
        $actor->is_representative = is_representative($actor->name, $json['status_infos']);
        $actor->insert($db);
        $actor->insertCoActor($db, $bill->id);
        //print $actor->toString() . "\n";
    }
    foreach ($json['withdrawers'] as $a) {
        $actor = new Actor($a);
        $actor->is_withdrawer = 1;
        $actor->insert($db);
        $actor->insertCoActor($db, $bill->id);
        //print $actor->toString() . "\n";
    }
}
コード例 #2
0
 /**
  *
  *
  *
  *
  * @return Bill bill for given booker
  */
 public function getBillForBooker($booker)
 {
     $channel = 'ecommerce';
     if ($booker instanceof FlightBookerComponent) {
         $booker = $booker->getCurrent();
     }
     if ($booker instanceof FlightBooker) {
         if ($booker->flightVoyage->webService == 'SABRE') {
             $channel = $booker->flightVoyage->valAirline->payableViaSabre ? 'gds_sabre' : 'ltr';
             $channel = 'ltr';
         }
         if ($booker->flightVoyage->webService == 'GALILEO') {
             $channel = $booker->flightVoyage->valAirline->payableViaGalileo ? 'gds_galileo' : 'ltr';
         }
     }
     if ($booker->billId) {
         return Bill::model()->findByPk($booker->billId);
     }
     $bill = new Bill();
     $bill->setChannel($channel);
     $bill->status = Bill::STATUS_NEW;
     $bill->amount = $booker->price;
     $bill->save();
     $booker->billId = $bill->id;
     $booker->save();
     return $bill;
 }
コード例 #3
0
ファイル: Router.php プロジェクト: xama5/uver-erp
 public function create()
 {
     $customerId = $this->request_stack["arguments"][0];
     $customer = CustomerQuery::create()->findOneById($customerId);
     $projects = $customer->getProjects();
     $invoice = new Invoice();
     $invoice->setCreated(time())->setDue(time() + 36000)->setPaid(0)->setCustomer($customer)->save();
     foreach ($projects as $project) {
         $tasks = $project->getTasks();
         foreach ($tasks as $task) {
             $bill = new Bill();
             $bill->setTask($task)->setInvoice($invoice)->save();
         }
     }
     $this->getRequest()->redirect("invoice", "index");
 }
コード例 #4
0
ファイル: CusDet.php プロジェクト: testoodoo/OoodooSiteUp
 public function bills()
 {
     $bills = Bill::where('account_id', '=', $this->account_id)->get();
     if (count($bills) != 0) {
         return $bills;
     }
     return null;
 }
コード例 #5
0
 public function loadModel($id)
 {
     $model = Bill::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
コード例 #6
0
ファイル: Card.php プロジェクト: ras263/lc
 public static function delete($id)
 {
     Bill::replace_bills($id);
     // перед удалением надо перекинуть все покупки на карту Администратора (00 999999)
     $db = new DB();
     $query = 'DELETE FROM cards WHERE card_id =' . $id;
     $db->query($query);
 }
コード例 #7
0
 function sendForBilling()
 {
     $response = new Response();
     try {
         $projectId = $this->input->post("project-id");
         $amount = $this->input->post("project-bill-amount");
         $billDoc = $this->input->post("bill-doc");
         $project = $this->findById("Project", $projectId);
         if ($project == null) {
             throw new RuntimeException("Invalid Project..!");
         }
         $project->setStatus(Project::PROJECT_BILL);
         $project->getWorkOrder()->setStatus(Workorder::STATUS_COMPLETED);
         $project->getWorkOrder()->setApprovedBy($this->getLoggedInUser());
         $bill = new Bill();
         $bill->setAmount($amount);
         $bill->setProject($project);
         $bill->setCreated(new DateTime());
         $bill->setStatus(Bill::STATUS_PENDING);
         if ($billDoc != null && $billDoc != "") {
             foreach ($billDoc as $file) {
                 $doc = new Document();
                 $doc->setName($file);
                 $doc->setCreated(new DateTime());
                 $bill->getBillDoc()->add($doc);
             }
         }
         $this->save($bill);
         $response->setData(Project::PROJECT_BILL);
     } catch (Exception $e) {
         $response->setStatus(false);
         $response->setErrorMessage($e->getMessage());
     }
     $this->output->set_content_type('application/json')->set_output(json_encode($response));
 }
コード例 #8
0
ファイル: SuccessAction.php プロジェクト: niranjan2m/Voyanga
 public function run()
 {
     if ($this->failure) {
         $method = 'FailureCallback';
     } else {
         $method = 'SuccessCallback';
     }
     $this->logEntry = PaymentLog::forMethod($method);
     $this->logEntry->request = '{"callback":1}';
     $this->logEntry->response = json_encode($_REQUEST);
     if (isset($_REQUEST['TransactionID'])) {
         $this->logEntry->transactionId = $_REQUEST['TransactionID'];
     }
     if (isset($_REQUEST['OrderId'])) {
         $this->logEntry->orderId = $_REQUEST['OrderId'];
     }
     $this->logEntry->save();
     foreach ($this->keys as $key) {
         if (!isset($_REQUEST[$key])) {
             $e = new RequestError("{$key} not found.");
             $this->handleException($e);
             return;
         }
         $params[$key] = $_REQUEST[$key];
     }
     $parts = explode('-', $params['OrderId']);
     if (count($parts) < 2) {
         $e = new RequestError("Wrong OrderId format: " . $params['OrderId']);
         $this->handleException($e);
         return;
     }
     list($orderId, $billId) = $parts;
     $bill = Bill::model()->findByPk($billId);
     $channel = $bill->getChannel();
     $sign = $channel->getSignature($params);
     if ($sign != $params['SecurityKey']) {
         $e = new SignatureError("Signature mismatch actual: " . $params['SecurityKey'] . ". Expected: " . $sign . ".");
         $this->handleException($e);
         //            return;
     }
     $booker = $channel->booker;
     if ($booker instanceof FlightBooker) {
         $booker = new FlightBookerComponent();
         $booker->setFlightBookerFromId($channel->booker->id);
     }
     // Hoteles are allways wrapped into metabooker
     //FIXME logme
     #        if($this->getStatus($booker)=='paid')
     #            return;
     if ($this->getStatus($booker) == 'paymentInProgress') {
         return;
     }
     $this->logEntry->startProfile();
     $this->handle($bill, $booker, $channel, $orderId);
     $this->logEntry->finishProfile();
     $this->logEntry->save();
 }
コード例 #9
0
ファイル: Cardscontroller.php プロジェクト: ras263/lc
 public function action_one()
 {
     $id = $_GET['id'];
     $items = Card::get_one($id);
     $bills = Bill::get_bills($id);
     $view = new View();
     $view->items = $items;
     $view->bills = $bills;
     $view->display('cards/cards_profile.php');
 }
コード例 #10
0
 public function sendEmailPaymentSuccess($params)
 {
     $user = CusDet::where('account_id', '=', $this->account_id)->get()->first();
     //var_dump($params);die;
     if (!is_null($user)) {
         $bill = Bill::where('bill_no', '=', $this->bill_no)->get()->first();
         if (!is_null($bill)) {
             $email = Config::get('custom_config.email');
             if (is_null($email)) {
                 $email = $user->email;
             }
             $data = array();
             $data['email'] = $email;
             $data['transaction'] = $this;
             $data['user'] = $user;
             $data['bill'] = $bill;
             $data['payer_email'] = $params['email'];
             $data['payer_name'] = $params['firstname'];
             $data['payer_phone'] = $params['phone'];
             if (!empty($data['email']) && !empty($data['payer_email'])) {
                 if ($email == $data['payer_email']) {
                     if ($this->transaction_type == "cheque") {
                         Mail::send('emails.payment_success_cheque', $data, function ($message) use($data) {
                             $message->to($data['email'], $data['user']->first_name)->subject("Payment Successfull");
                         });
                     } else {
                         Mail::send('emails.payment_success_cash', $data, function ($message) use($data) {
                             $message->to($data['email'], $data['user']->first_name)->subject("Payment Successfull");
                         });
                     }
                 } else {
                     if ($this->transaction_type == "cheque") {
                         Mail::send('emails.payment_success_cheque', $data, function ($message) use($data) {
                             $message->to($data['email'], $data['user']->first_name)->subject("Payment Successfull");
                         });
                         Mail::send('emails.payment_success_to_payer_cheque', $data, function ($message) use($data) {
                             $message->to($data['payer_email'], $data['payer_name'])->subject("Payment Successfull");
                         });
                     } else {
                         Mail::send('emails.payment_success_cash', $data, function ($message) use($data) {
                             $message->to($data['email'], $data['user']->first_name)->subject("Payment Successfull");
                         });
                         Mail::send('emails.payment_success_to_payer_cash', $data, function ($message) use($data) {
                             $message->to($data['payer_email'], $data['payer_name'])->subject("Payment Successfull");
                         });
                     }
                 }
             }
         }
     }
 }
コード例 #11
0
ファイル: getBill.php プロジェクト: hunkim/assembly
function getBill($id, $content)
{
    $txt = strip_tags($content);
    $tokens = preg_split('/\\n+/', $txt);
    $idx = 0;
    $title = "";
    $summary = "";
    $start = false;
    foreach ($tokens as $line) {
        $line = trim($line);
        // let's trim
        if (strpos($line, "제안이유") !== false) {
            $start = true;
        }
        if (!$start) {
            continue;
        }
        if ($line === "" || strpos($line, "제안이유") !== false || strpos($line, "http://") !== false) {
            continue;
        }
        // assume the first text is the title
        if ($idx++ == 0) {
            $title = $line;
        } else {
            $summary .= "{$line}\n";
        }
    }
    // 교육기본법 일부개정법률안(1910565) split them
    list($titleOnly, $bid) = explode("(", $title);
    echo "{$titleOnly}:{$bid}";
    $bill = new Bill($id);
    $bill->bid = intval($bid);
    assert($bid !== "");
    assert($titleOnly !== "");
    $bill->setTitleSum(trim($titleOnly), trim($summary));
    return $bill;
}
コード例 #12
0
 function fix($bill_id)
 {
     $products = $this->getByBillId($bill_id);
     $product = new Product();
     $price = new Price();
     $tax = new Tax();
     $bill = new Bill();
     $tmp = $bill->get($bill_id);
     $bill_data = $tmp[0];
     $customer = new Customer();
     $tmp = $customer->get($bill_data[1]);
     $customer_data = $tmp[0];
     for ($i = 0; $i < count($products); $i++) {
         $tmp = $this->getByBillIdAndProductId($bill_id, $products[$i][2]);
         $bill_product_data = $tmp[0];
         $tmp = $product->get($products[$i][2]);
         $product_data = $tmp[0];
         $tmp = $price->getPrice($customer_data[11], $product_data[0]);
         $price_data = $tmp[0];
         $tmp = $tax->get($product_data[4]);
         $tax_data = $tmp[0];
         $this->update($bill_product_data[0], array($bill_product_data[1], $bill_product_data[2], $bill_product_data[3], $bill_product_data[4], $bill_product_data[5], $price_data[3], $tax_data[2]));
     }
 }
コード例 #13
0
 public static function BillBalance($account_id)
 {
     $amount_before_date = Bill::orderBy('bill_no', 'desc')->where('account_id', '=', $account_id)->get()->first();
     if (count($amount_before_date) != 0) {
         $amount_before_due_date = $amount_before_date->amount_before_due_date;
         $amount_paid = Bill::orderBy('bill_no', 'desc')->where('account_id', '=', $account_id)->get()->first()->amount_paid;
         $bal = $amount_paid - $amount_before_due_date;
         if ($amount_paid == 0) {
             $bal = 0;
         }
         return $bal;
     } else {
         return 0;
     }
 }
コード例 #14
0
<?php

require_once "util.php";
require_once "DataBase/Product.php";
require_once "DataBase/Bill.php";
require_once "DataBase/Tour.php";
require_once "DataBase/Bill_Product.php";
$tour_id = var_get("tour_id", "");
$date = var_get("date", "");
$bill = new Bill();
$bill_data = $bill->get("", array("bill_id"), "tour_id='" . $tour_id . "' AND date='" . $date . "'");
$tour = new Tour();
$tmp = $tour->get($tour_id);
$tour_data = $tmp[0];
$bill_product = new Bill_Product();
$product = new Product();
$product_data = $product->get();
include "Druckvorlagen/tour.php";
?>

コード例 #15
0
 function createBill()
 {
     $bill = new Bill();
     $customer = new Customer();
     $tour = new Tour();
     $bill_product = new Bill_Product();
     $customer_data = $customer->get($this->customer_id);
     if (count($customer_data) == 0) {
         echo "<div class=\"error\">Fehler in Session, bitte neu anmelden</div><br>\n";
         return -1;
     }
     $tour_data = $tour->getByAssistant($customer_data[0][12]);
     $bill_id = $bill->create("", array($this->customer_id, $customer_data[0][12], "", $tour_data[0][2], -2, time()));
     $list = $this->getItems();
     for ($i = 0; $i < count($list); $i++) {
         if ($list[$i][2] > 0) {
             $bill_product->create(array($bill_id, $list[$i][0], $list[$i][2], $list[$i][5], "", 0, 0, time()));
         }
     }
     return 0;
 }
コード例 #16
0
 public static function checkout_response($registrationid, $PayerID, $token)
 {
     //we will be using these two variables to execute the "DoExpressCheckoutPayment"
     //Note: we haven't received any payment yet.
     $token = $_GET["token"];
     $payer_id = $_GET["PayerID"];
     $PayPalMode = Config::get('billing.paypalmode');
     // sandbox or live
     $PayPalApiUsername = Config::get('billing.paypalapiusername');
     //PayPal API Username
     $PayPalApiPassword = Config::get('billing.paypalapipassword');
     //Paypal API password
     $PayPalApiSignature = Config::get('billing.paypalapisignature');
     //Paypal API Signature
     $totalitemstring = Session::get('totalitemstring');
     $GrandTotal = Session::get('grandtotal');
     if ($totalitemstring == NULL || $GrandTotal == NULL) {
         return Redirect::to('/billing')->with('message', 'Your session has timed out, your card has not been charged, please try again.');
     }
     $padata = '&TOKEN=' . urlencode($token) . '&PAYERID=' . urlencode($payer_id) . '&PAYMENTREQUEST_0_PAYMENTACTION=' . urlencode("SALE") . $totalitemstring . '&PAYMENTREQUEST_0_AMT=' . urlencode($GrandTotal) . '&PAYMENTREQUEST_0_CUSTOM=' . urlencode($registrationid);
     //We need to execute the "DoExpressCheckoutPayment" at this point to Receive payment from user.
     $paypal = new PayPal();
     $httpParsedResponseAr = $paypal->PPHttpPost('DoExpressCheckoutPayment', $padata, $PayPalApiUsername, $PayPalApiPassword, $PayPalApiSignature, $PayPalMode);
     // we can retrive transection details using either GetTransactionDetails or GetExpressCheckoutDetails
     // GetTransactionDetails requires a Transaction ID, and GetExpressCheckoutDetails requires Token returned by SetExpressCheckOut
     $paypal = new PayPal();
     if ("SUCCESS" == strtoupper($httpParsedResponseAr["ACK"]) || "SUCCESSWITHWARNING" == strtoupper($httpParsedResponseAr["ACK"])) {
         $orderid = urldecode($httpParsedResponseAr['PAYMENTINFO_0_TRANSACTIONID']);
         $status = urldecode($httpParsedResponseAr['PAYMENTINFO_0_PAYMENTSTATUS']);
     } else {
         $orderid = 'N/A';
     }
     $padata = '&TOKEN=' . urlencode($token);
     $httpParsedResponseAr = $paypal->PPHttpPost('GetExpressCheckoutDetails', $padata, $PayPalApiUsername, $PayPalApiPassword, $PayPalApiSignature, $PayPalMode);
     $totalamount = urldecode($httpParsedResponseAr['AMT']);
     $registrationid = Auth::user()->registration->registrationid;
     $status = str_replace('PaymentAction', '', urldecode($httpParsedResponseAr['CHECKOUTSTATUS']));
     $order = new Bill();
     $order->registrationid = $registrationid;
     $order->method = "PayPal";
     $order->currency = 'USD';
     $order->description = 'PayPal Order Number: ' . $orderid;
     $order->amount = $totalamount;
     $order->checkout_id = $orderid;
     $order->status = ucwords($status);
     $order->save();
 }
コード例 #17
0
 function DisplayDeletedQuotationsSummary($start_timeframe, $end_timeframe, $pricelist)
 {
     global $db;
     global $PRINTOUT;
     global $LDDeletedQuotationsReport, $LDstarttime, $LDendtime;
     $first_day_of_req_month = 0;
     $last_day_of_req_month = 0;
     $end_timeframe += 24 * 60 * 60 - 1;
     echo $LDeletedQuotationsReport . ": " . $LDstarttime . ": " . date("d.m.y :: G:i:s", $start_timeframe) . " " . $LDendtime . ": " . date("d.m.y :: G:i:s", $end_timeframe) . "<br>";
     $bill_obj = new Bill();
     if ($this->_Create_deleted_quotations_tmp_master_table($start_timeframe, $end_timeframe)) {
         $del_items = $this->GetDeletedQuotations();
     }
     $total_del = 0;
     if ($del_items) {
         while ($del_row = $del_items->FetchRow()) {
             $counter++;
             if ($color_change) {
                 $BGCOLOR = 'bgcolor="#ffffdd"';
                 $color_change = FALSE;
             } else {
                 $BGCOLOR = 'bgcolor="#ffffaa"';
                 $color_change = TRUE;
             }
             $price = $bill_obj->getPrice($del_row['item_id'], $pricelist);
             $amount = $del_row['amount'] * $price;
             $total_del += $amount;
             $table .= "<td bgcolor=\"{$bg_color}\" align=\"right\">" . $italic_tag_open . $del_row['encounter_date'] . $italic_tag_close . "</td>\n";
             $table .= "<td bgcolor=\"{$bg_color}\" align=\"right\">" . $italic_tag_open . $del_row['item_description'] . $italic_tag_close . "</td>\n";
             $table .= "<td bgcolor=\"{$bg_color}\" align=\"right\">" . $italic_tag_open . $del_row['amount'] . $italic_tag_close . "</td>\n";
             $table .= "<td bgcolor=\"{$bg_color}\" align=\"right\">" . $italic_tag_open . $price . $italic_tag_close . "</td>\n";
             $table .= "<td bgcolor=\"{$bg_color}\" align=\"right\">" . $italic_tag_open . $amount . $italic_tag_close . "</td>\n";
             $table .= "<td bgcolor=\"{$bg_color}\" align=\"right\">" . $italic_tag_open . $del_row['disable_id'] . $italic_tag_close . "\t\t\t\t\t\t</td>\n";
             $table .= "<td bgcolor=\"{$bg_color}\" align=\"right\">" . $italic_tag_open . $del_row['disable_date'] . $italic_tag_close . "\r\n</td>\n";
             $table .= "</tr>\n";
         }
     }
     $table .= "<tr>\n";
     if (!$PRINTOUT) {
         $bg_color = "#CC9933";
     }
     $table .= "<td bgcolor=\"{$bg_color}\" align = \"center\"><strong>&sum;</strong></td>\n";
     $table .= "<td bgcolor=\"{$bg_color}\" align = \"center\"></td>\n";
     $table .= "<td bgcolor=\"{$bg_color}\" align = \"center\"></td>\n";
     $table .= "<td bgcolor=\"{$bg_color}\" align = \"center\"></td>\n";
     $table .= "<td bgcolor=\"{$bg_color}\" align=\"right\">" . $italic_tag_open . $total_del . $italic_tag_close . "</td>\n";
     $table .= "<td bgcolor=\"{$bg_color}\" align = \"center\"></td>\n";
     $table .= "<td bgcolor=\"{$bg_color}\" align = \"center\"></td>\n";
     $table .= "</tr>\n";
     $table .= "</tr>\n";
     echo $table;
     //}
 }
コード例 #18
0
    $_SESSION['sess_full_en'];
}
$patregtable = 'care_person';
// The table of the patient registration data
$dbtable = 'care_encounter';
// The table of admission data
/* Create new person's insurance object */
$pinsure_obj = new PersonInsurance($pid);
/* Get the insurance classes */
$insurance_classes =& $pinsure_obj->getInsuranceClassInfoObject('class_nr,name,LD_var AS "LD_var"');
/* Create new person object */
$person_obj = new Person($pid);
/* Create encounter object */
$encounter_obj = new Encounter($encounter_nr);
/* Create a new billing object */
$bill_obj = new Bill();
/* Get all encounter classes */
$encounter_classes = $encounter_obj->AllEncounterClassesObject();
if ($pid != '' || $encounter_nr != '') {
    /* Get the patient global configs */
    $glob_obj = new GlobalConfig($GLOBAL_CONFIG);
    $glob_obj->getConfig('patient_%');
    $glob_obj->getConfig('person_foto_path');
    $glob_obj->getConfig('encounter_%');
    if (!$GLOBAL_CONFIG['patient_service_care_hide']) {
        /* Get the care service classes*/
        $care_service = $encounter_obj->AllCareServiceClassesObject();
    }
    if (!$GLOBAL_CONFIG['patient_service_room_hide']) {
        /* Get the room service classes */
        $room_service = $encounter_obj->AllRoomServiceClassesObject();
コード例 #19
0
ファイル: contacts.php プロジェクト: nicarayz/linabiz
 function index_get()
 {
     $filters = $this->get("filter")["filters"];
     $page = $this->get('page') !== false ? $this->get('page') : 1;
     $limit = $this->get('limit') !== false ? $this->get('limit') : 50;
     $sort = $this->get("sort");
     $data["results"] = array();
     $data["count"] = 0;
     $obj = new Contact(null, $this->entity);
     //Sort
     if (!empty($sort) && isset($sort)) {
         foreach ($sort as $value) {
             $obj->order_by($value["field"], $value["dir"]);
         }
     }
     //Filter
     if (!empty($filters) && isset($filters)) {
         $deleted = 0;
         foreach ($filters as $value) {
             if (!empty($value["operator"]) && isset($value["operator"])) {
                 if ($value["operator"] == "where_in") {
                     $obj->where_in($value["field"], $value["value"]);
                 } else {
                     if ($value["operator"] == "or_where_in") {
                         $obj->or_where_in($value["field"], $value["value"]);
                     } else {
                         if ($value["operator"] == "where_not_in") {
                             $obj->where_not_in($value["field"], $value["value"]);
                         } else {
                             if ($value["operator"] == "or_where_not_in") {
                                 $obj->or_where_not_in($value["field"], $value["value"]);
                             } else {
                                 if ($value["operator"] == "like") {
                                     $obj->like($value["field"], $value["value"]);
                                 } else {
                                     if ($value["operator"] == "or_like") {
                                         $obj->or_like($value["field"], $value["value"]);
                                     } else {
                                         if ($value["operator"] == "not_like") {
                                             $obj->not_like($value["field"], $value["value"]);
                                         } else {
                                             if ($value["operator"] == "or_not_like") {
                                                 $obj->or_not_like($value["field"], $value["value"]);
                                             } else {
                                                 if ($value["operator"] == "startswith") {
                                                     $obj->like($value["field"], $value["value"], "after");
                                                 } else {
                                                     if ($value["operator"] == "endswith") {
                                                         $obj->like($value["field"], $value["value"], "before");
                                                     } else {
                                                         if ($value["operator"] == "contains") {
                                                             $obj->like($value["field"], $value["value"], "both");
                                                         } else {
                                                             if ($value["operator"] == "or_where") {
                                                                 $obj->or_where($value["field"], $value["value"]);
                                                             } else {
                                                                 if ($value["operator"] == "search") {
                                                                     $obj->like("number", $value["value"], "after");
                                                                     $obj->or_like("surname", $value["value"], "after");
                                                                     $obj->or_like("name", $value["value"], "after");
                                                                     $obj->or_like("company", $value["value"], "after");
                                                                 } else {
                                                                     $obj->where($value["field"] . ' ' . $value["operator"], $value["value"]);
                                                                 }
                                                             }
                                                         }
                                                     }
                                                 }
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             } else {
                 if ($value["field"] == "deleted") {
                     $deleted = $value["value"];
                 } else {
                     $obj->where($value["field"], $value["value"]);
                 }
             }
         }
         $obj->where("deleted", $deleted);
     }
     if (!empty($limit) && !empty($page)) {
         $obj->get_paged_iterated($page, $limit);
         $data["count"] = $obj->paged->total_rows;
     }
     if ($obj->result_count() > 0) {
         foreach ($obj as $value) {
             $bal = new Bill(null, $this->entity);
             $bal->select_sum("amount");
             $bal->where("contact_id", $value->id);
             $bal->where("status", 0);
             if ($value->contact_type_id == 5) {
                 $bal->where("type", "bill");
             } else {
                 $bal->where("type", "invoice");
             }
             $bal->get();
             //Fullname
             $fullname = $value->surname . ' ' . $value->name;
             if ($value->contact_type_id == 3 || $value->contact_type_id == 5) {
                 $fullname = $value->company;
             }
             $data["results"][] = array("id" => $value->id, "currency_id" => $value->currency_id, "user_id" => $value->user_id, "contact_type_id" => $value->contact_type_id, "number" => $value->number, "surname" => $value->surname, "name" => $value->name, "gender" => $value->gender, "dob" => $value->dob, "pob" => $value->pob, "address" => $value->address, "family_member" => $value->family_member, "id_number" => $value->id_number, "phone" => $value->phone, "email" => $value->email, "job" => $value->job, "company" => $value->company, "image_url" => $value->image_url, "memo" => $value->memo, "credit_limit" => $value->credit_limit, "status" => $value->status, "registered_date" => $value->registered_date, "deleted" => $value->deleted, "fullname" => $fullname, "fullIdName" => $value->number . ' ' . $fullname, "contact_type" => $value->contact_type->get_raw()->result(), "balance" => floatval($bal->amount));
         }
     }
     // //Response Data
     $this->response($data, 200);
 }
コード例 #20
0
 public function testHash()
 {
     // test_token|sale_id_1|optional|user defined|http://txn_completed|http://server_side_notification_url|INR|5.00
     // test_token|sale_id_1|optional|user defined|http://txn_completed|http://server_side_notification_url|INR|5.00
     $bill = new Bill();
     $bill->setAccessToken("test_token");
     $bill->setCommand("debit");
     $bill->setUniqueId("sale_id_1");
     $bill->setComments("optional");
     $bill->setUdf("user defined");
     $bill->setReturnUrl("http://txn_completed");
     $bill->setNotificationUrl("http://server_side_notification_url");
     $bill->setAmount("5.00");
     $bill->setCurrency("INR");
     $hash = $bill->getHash("merchant_salt");
     echo "Hash String [" . $bill . "]\n";
     if (0 != strcmp($hash, "7a97febb1ee0fd596936be066b1617ded7ac558248985a22f7dcc770ad399874f16ad5ff3e2168326582a96d68445ed297540b8a64affc36938a11e0cd1d64e7")) {
         echo "Hash Mismatch : " . $hash;
         throw new \Exception();
     } else {
         echo "Hash : " . $hash;
     }
 }
コード例 #21
0
ファイル: aufnahme_start.php プロジェクト: patmark/care2x-tz
    $_SESSION['sess_full_en'];
}
$patregtable = 'care_person';
// The table of the patient registration data
$dbtable = 'care_encounter';
// The table of admission data
/* Create new person's insurance object */
$pinsure_obj = new PersonInsurance($pid);
/* Get the insurance classes */
$insurance_classes =& $pinsure_obj->getInsuranceClassInfoObject('class_nr,name,LD_var AS "LD_var"');
/* Create new person object */
$person_obj = new Person($pid);
/* Create encounter object */
$encounter_obj = new Encounter($encounter_nr);
/* Create a new billing object */
$bill_obj = new Bill();
/* Get all encounter classes */
$encounter_classes = $encounter_obj->AllEncounterClassesObject();
if ($pid != '' || $encounter_nr != '') {
    /* Get the patient global configs */
    $glob_obj = new GlobalConfig($GLOBAL_CONFIG);
    $glob_obj->getConfig('patient_%');
    $glob_obj->getConfig('person_foto_path');
    $glob_obj->getConfig('encounter_%');
    if (!$GLOBAL_CONFIG['patient_service_care_hide']) {
        /* Get the care service classes*/
        $care_service = $encounter_obj->AllCareServiceClassesObject();
    }
    if (!$GLOBAL_CONFIG['patient_service_room_hide']) {
        /* Get the room service classes */
        $room_service = $encounter_obj->AllRoomServiceClassesObject();
コード例 #22
0
require_once "DataBase/Group.php";
require_once "DataBase/Priceset.php";
require_once "DataBase/Price.php";
require_once "DataBase/Category.php";
require_once "DataBase/Tax.php";
require_once "DataBase/Assistant.php";
require_once "DataBase/Bill.php";
require_once "DataBase/Bill_Product.php";
$group = new Group();
$priceset = new Priceset();
$category = new Category();
$product = new Product();
$price = new Price();
$tax = new Tax();
$assistant = new Assistant();
$bill = new Bill();
if (var_post("print", "") == "print_re") {
    $search = "";
    if (var_post("product_id", "")) {
        if ($search) {
            $search .= " AND (product_id >=" . var_post("product_id", "") . ") ";
        } else {
            $search .= "(product_id >=" . var_post("product_id", "") . ") ";
        }
    }
    if (var_post("date_from", "")) {
        if ($search) {
            $search .= " AND (date >='" . var_post("date_from", "") . "') ";
        } else {
            $search .= "(date >='" . var_post("date_from", "") . "') ";
        }
コード例 #23
0
<?php

include "DataBase/database.php";
include "DataBase/Bill.php";
include "DataBase/Bill_Product.php";
$bill = new Bill();
$bill_product = new Bill_Product();
$folder = "mysql_export/";
if ($bill->export($folder . "bill.csv")) {
    echo "rechnung export erfolgreich<br>";
} else {
    echo "rechnung export schlug fehl<br>";
}
if ($bill_product->export($folder . "bill_product.csv")) {
    echo "bill_product export erfolgreich<br>";
} else {
    echo "bill_product export schlug fehl<br>";
}
?>

<br>
Synchronisation abgeschlossen
コード例 #24
0
<?php

require_once "DataBase_Net/Bill_Net.php";
require_once "DataBase_Net/Bill_Product_Net.php";
require_once "DataBase/Bill.php";
require_once "DataBase/Bill_Product.php";
// sync Bill database
$bill = new Bill();
$bill_net = new Bill_Net();
$bill_product = new Bill_Product();
$bill_product_net = new Bill_Product_Net();
$new_bills_count = 0;
$new_position_count = 0;
// fetch all remote bills
$remote_bills = $bill_net->getPlainBills();
foreach ($remote_bills as $tmp) {
    $new_bill_id = $bill->create("", array_slice($tmp, 1));
    $new_bills_count++;
    // check for bill_products
    $remote_bill_products = $bill_product_net->getByBillId($tmp[0]);
    foreach ($remote_bill_products as $tmp1) {
        $tmp1[1] = $new_bill_id;
        $bill_product->create(array_slice($tmp1, 1));
        $new_position_count++;
    }
}
$main_box->add(new NTKLabel("", "neue Rechnungen: " . $new_bills_count), 200, 0, "background-color: #dfe7f3;");
$main_box->add(new NTKLabel("", "neue Positionen: " . $new_position_count), 200, 0, "background-color: #dfe7f3;");
// now we should have added all bills let's delete them remote
$bill_net->clearTable();
$bill_product_net->clearTable();
コード例 #25
0
/* The current url, oauth_token, orgId and Terminal Id provided in this example, are only for testing purposes
*  For development purposes you need to contact the Payhub Integration Support team. They will provide you with  *   all you need.
*  Thanks.
*/
$path_to_IncludeClases = "../com/payhub/ws/extra/includeClasses.php";
include_once $path_to_IncludeClases;
//Defining the Web Service URL
$WsURL = "https://sandbox-api.payhub.com/api/v2/";
$oauth_token = "2a5d6a73-d294-4fba-bfba-957a4948d4a3";
//Defining data for the SALE transaction
// Merchant data (obtained from the payHub Virtual Terminal (3rd party integration)
$merchant = new Merchant();
$merchant->setOrganizationId(10074);
$merchant->setTerminalId(134);
$bill = new Bill();
$bill->setBaseAmount(1.0);
//Credit card data
$card_data = new CardData();
$card_data->setCardNumber("4012881888818888");
$card_data->setCardExpiryDate("202012");
$card_data->setBillingZip("60527");
// Customer data
$customer = new Customer();
$customer->setFirstName("Joe");
$customer->setLastName("Tester");
$customer->setPhoneNumber("844-217-1631");
$customer->setPhoneType("M");
$montly_s = new MontlySchedule();
$montly_s->monthly_type = "E";
$montly_s->monthly_each_days = array(15);
コード例 #26
0
ファイル: Bill.class.php プロジェクト: centaurustech/truc
    public static function invoice_from_report($report, $event)
    {
        $bill = new Bill();
        $bill->user_id = $_SESSION['user_id'];
        $bill->target = BILL_TARGET_ORGANIZER;
        $bill->client_name = $event->organizer_name;
        $bill->event_id = $event->id;
        $bill->client_address_id = $event->billing_address_id;
        $bill->client_vat = $event->vat;
        $bill->type = BILL_TYPE_INVOICE;
        $organizer = User::get_biller();
        $bill->biller_address_id = $organizer->address_id;
        $bill->biller_name = $organizer->get_company_name();
        $bill->biller_vat = $organizer->vat;
        $label = "Event-Biller-I-";
        $bill->label = $label . "EVT-" . sprintf("%06d", $event->id);
        $tickets = $event->get_tickets();
        $item = new Item('/item/service_fee');
        $item->quantity = 1;
        $sold_ticket_nbr = $report["ticket_quantity"];
        $rate = deal_get_description($event->deal_name);
        $amount_ticket_sales = $report['total'];
        $item->description = <<<EOF
<b>{{Ticket sales fees}}</b><br/>
{{Amount ticket sales:}}&nbsp;{$amount_ticket_sales}€&nbsp;&nbsp;&nbsp;{{Sold ticket number:}}&nbsp;{$sold_ticket_nbr}<br/>
{{Rate details:}}&nbsp;{$rate}
EOF;
        $item->tax_rate = 19.6;
        $item->total_ttc = curr($report['eb_fee']);
        $item->total_ht = curr($item->total_ttc / (1 + $item->tax_rate / 100));
        $item->total_tax = $item->total_ttc - $item->total_ht;
        $bill->items[] = $item;
        $bill->compute();
        return $bill;
    }
コード例 #27
0
 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update($id)
 {
     $bill = Bill::findOrFail($id);
     $data = Input::all();
     $bill->update($data);
     return Redirect::route('bill.index');
 }
コード例 #28
0
require './roots.php';
require $root_path . 'include/inc_environment_global.php';
/**
* CARE2X Integrated Hospital Information System Deployment 2.1 - 2004-10-02
* GNU General Public License
* Copyright 2005 Robert Meggle based on the development of Elpidio Latorilla (2002,2003,2004,2005)
* elpidio@care2x.org, meggle@merotech.de
*
* See the file "copy_notice.txt" for the licence notice
*/
//define('NO_2LEVEL_CHK',1);
$lang_tables[] = 'billing.php';
$lang_tables[] = 'aufnahme.php';
require $root_path . 'include/inc_front_chain_lang.php';
require $root_path . 'include/care_api_classes/class_tz_billing.php';
$billing_tz = new Bill();
require $root_path . 'include/care_api_classes/class_tz_insurance.php';
$insurance_tz = new Insurance_tz();
require_once $root_path . 'include/care_api_classes/class_person.php';
$person_obj = new Person();
if ($todo == 'balancecontractnow') {
    if ($_SESSION['balance']) {
        var_dump($_SESSION['balance']);
        while (list($x, $v) = each($_SESSION['balance'])) {
            if ($v < 0) {
                $billing_tz->CreateBalanceBill($x, $v);
            }
        }
        $_SESSION['balance'] = false;
    }
    echo '---';
コード例 #29
0
require './roots.php';
require $root_path . 'include/inc_environment_global.php';
/**
* CARE2X Integrated Hospital Information System Deployment 2.1 - 2004-10-02
* GNU General Public License
* Copyright 2005 Robert Meggle based on the development of Elpidio Latorilla (2002,2003,2004,2005)
* elpidio@care2x.org, meggle@merotech.de
*
* See the file "copy_notice.txt" for the licence notice
*/
require_once $root_path . 'include/care_api_classes/class_encounter.php';
require_once $root_path . 'include/care_api_classes/class_tz_billing.php';
//require_once($root_path.'include/care_api_classes/class_tz_insurance.php');
//$insurance_tz = New Insurance_tz;
$enc_obj = new Encounter();
$bill_obj = new Bill();
require_once $root_path . 'include/care_api_classes/class_tz_drugsandservices.php';
$drg_obj = new DrugsAndServices();
$lang_tables[] = 'billing.php';
$lang_tables[] = 'aufnahme.php';
require $root_path . 'include/inc_front_chain_lang.php';
//$encounter_nr = $_REQUEST['encounter_nr'];
$comment = $_POST['notes'];
$user = $_SESSION['sess_user_name'];
$date = date('Y-m-d', time());
$advance_payment = $_POST['advance'];
if ($advance_payment) {
    if (!isset($new_bill_number)) {
        $new_bill_number = $bill_obj->CreateNewBill($encounter_nr);
    }
    $description = 'Advance';
コード例 #30
0
ファイル: modelTest.php プロジェクト: hugoabonizio/torm
 /**
  * Test all method
  *
  * @return null
  */
 public function testAll()
 {
     $users = User::all();
     $user = $users->next();
     $this->assertEquals("Eustaquio Rangel", $user->name);
     $user = $users->next();
     $this->assertEquals("Rangel, Eustaquio", $user->name);
     echo "checking all users ...\n";
     $count = 0;
     foreach (User::all() as $user) {
         echo "user: "******"\n";
         $count++;
     }
     $this->assertEquals(2, $count);
     $count = 0;
     $pos = 1;
     foreach (Bill::all() as $bill) {
         $this->assertEquals("Bill #{$pos}", $bill->description);
         $this->assertEquals($pos, $bill->value);
         $pos++;
         $count++;
     }
     $this->assertEquals(10, $count);
 }