Skip to content

Instantly share code, notes, and snippets.

@tareko
tareko / gist:3138986
Created July 18, 2012 21:21
better approach
$post = $this->Post->find('first', array('conditions'=> array('Post.id'=>$id)));
$this->set('page_title', 'BLOG :: ' .$post['Post']['title']);
$this->set('post', $post);
@tareko
tareko / gist:3141131
Created July 19, 2012 06:22
Trade add rendered
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>
Kitab Al-Shifa: Trades </title>
<link rel="stylesheet" type="text/css" href="/kitab/css/cake.generic.css" /></head>
<body>
<div id="container">
<div id="content">
<form action="/kitab/trades/add" id="TradeAddForm" method="post" accept-charset="utf-8"><div style="display:none;"><input type="hidden" name="_method" value="POST"/></div>
@tareko
tareko / gist:3777004
Created September 24, 2012 16:57
function I'm testing
function lastUpdated($id, Shift $shift) {
App::uses('Shift', 'Model');
$this->Shift = $shift;
$calendar = $this->findById($id, array(
'start_date', 'end_date'));
return $this->Shift->find('first', array(
'fields' => array('Shift.updated'),
'conditions' => array(
'Shift.date >=' => $calendar['Calendar']['start_date'],
'Shift.date <=' => $calendar['Calendar']['end_date'],
@tareko
tareko / gist:3777956
Created September 24, 2012 19:52
attempt at fix?
function pdfUpdate() {
$this->loadModel('Calendar');
$calendars = $this->Calendar->find('list',array(
'id',
'start_date'));
foreach ($calendars as $id => $start_date) {
if (!$this->Calendar->needsUpdate($id)) {
$notUpdated[] = $id;
}
else {
@tareko
tareko / gist:3903808
Created October 17, 2012 05:12
reg matching..
function import ($filename) {
App::uses('File', 'Utility');
// Set the filename to read from
$filename = TMP . 'uploads' . DS . 'Billing' . DS . $filename;
echo $filename;
// Open the file
$file = new File($filename, FALSE);
$file->open();
// Grab the contents
@tareko
tareko / gist:3922543
Created October 20, 2012 07:42
Creating the array
function import ($filename) {
// Set the filename to read from
$filename = $filename;
// Open the file
if (!$file = fopen($filename, 'r')) {
return false;
}
// Start parsing for health encounters
@tareko
tareko / gist:3922555
Created October 20, 2012 07:43
What the array looks like
array(
(int) 1 => array(
'healthcare_provider' => '010800',
(int) 1 => array(
'patient_birthdate' => '19550807',
'payment_program' => 'HCP',
'payee' => 'P',
'referring' => '',
'BillingsItems' => array(
(int) 0 => array(
echo $this->Form->create('Billing');
echo $this->Form->input('Billing.0.healthcare_provider');
echo $this->Form->input('Billing.0.patient_birthdate');
echo $this->Form->input('Billing.0.payment_program');
echo $this->Form->input('Billing.0.payee');
echo $this->Form->input('Billing.0.BillingsItem.0.service_date');
echo $this->Form->input('Billing.0.BillingsItem.0.service_code');
echo $this->Form->input('Billing.0.BillingsItem.1.service_date');
echo $this->Form->input('Billing.0.BillingsItem.1.service_code');
@tareko
tareko / gist:3922879
Created October 20, 2012 10:16
Billing model
<?php
App::uses('AppModel', 'Model');
/**
* Billing Model
*
* @property BillingsItem $BillingsItem
*/
class Billing extends AppModel {
/**
@tareko
tareko / gist:3922881
Created October 20, 2012 10:17
BillingsItem model
<?php
App::uses('AppModel', 'Model');
/**
* BillingsItem Model
*
* @property Billings $Billings
*/
class BillingsItem extends AppModel {
/**