date" code below will return null // and call this only after you calculated the dates or else the calculations will be lost $datetimeobj->__wakeup(); // Return the calculated date return $datetimeobj->date; } function expense_getstatusfordisplay($status) { if (!$status) return; if (client_portal()) { switch ($status) { case "agentsubmit": return "New Expense Approval Request"; case "agentdocumentation": return "Approved"; case "clientverifydocumentation": return "Submitted"; case "clientwaitingpayment": return "In Process"; case "clientpaid": return "Completed/Paid"; case "clientwaiting": return "Completed/Paid"; case "canceled": return "Canceled"; case "denied": return "Denied"; } } else { switch ($status) { case "agentsubmit": return "New Expense Request"; case "agentdocumentation": return "Approved (Waiting for Agent Submission)"; case "clientverifydocumentation": return "Submitted by Agent"; case "clientwaitingpayment": return "Approved Check Requested"; case "clientpaid": return "Completed Paid to Agent"; case "clientwaiting": return "Waiting for Client Reimbursement"; case "canceled": return "Canceled"; case "denied": return "Denied"; } } } function expense_getdocumenttypes($filename = '') { $a = array(); // Only images can be before and after photo if (!$filename || ($filename && ( stristr($filename, 'jpg') || stristr($filename, 'jpeg') || stristr($filename, 'png') || stristr($filename, 'gif')))) { $a[beforephoto] = "Before Photo"; $a[afterphoto] = "After Photo"; } $a[estimate] = "Estimate"; $a[receipt] = "Receipt"; $a[misc] = "Misc"; $a[invoice] = "Invoice"; $a[w9] = "W9"; $a[proofofpayment] = "Proof of Payment"; return $a; } function expense_getimageonlytypes() { $a = array(); $a[beforephoto] = "Before Photo"; $a[afterphoto] = "After Photo"; return $a; } function expense_getloginnames($loginidarr) { if (!is_array($loginidarr)) return array(); $sql = " select tbllogin.loginid , staffid , clientstaffid , accountid , coalesce(trim(assignfname||' '||assignlname), trim(clientstafffname||' '||clientstafflname), clientcompanyname, loginusername) as name from tbllogin left join vw_assigntypes using (accountstaffid, staffid, externaluserid) left join tblclientstaff using (clientstaffid) left join tblclientcompany using (clientcompanyid) where tbllogin.loginid in ( ".implode(",", $loginidarr)." )"; $loginarr = db_query($sql,1,0, loginid); return $loginarr; } function expense_getusertypes($loginarr) { foreach ($loginarr as $id => $data) { if ($data[staffid]) $loginarr[$id][type] = '(Agent)'; else if ($data[clientstaffid]) $loginarr[$id][type] = '(Staff)'; else if ($data[accountid]) $loginarr[$id][type] = '(Vendor)'; } //d("expense_getusertypes", $loginarr); return $loginarr; } function expense_listofagentsforproperty($clientcompanypropertyid) { if (!$clientcompanypropertyid) return array(); $sql = "select distinct clientcompanypropertyassignmentid , assignmentmethodname --, coalesce(stafffname, accountstafffname) || ' ' || coalesce(stafflname, accountstafflname) as name , assignname as name from tblclientcompanypropertyassignment join tblclientcompanyproperty using (clientcompanypropertyid) --left join tblstaff using (staffid) --left join tblaccountstaff using (accountstaffid) join tblassignmentmethod using (assignmentmethodid) join vw_assigntypes using(accountstaffid, staffid, externaluserid, assignmentaliasclientstaffid) where clientcompanypropertyassignmentaccepteddate is not null and clientcompanypropertyassignmentdenieddate is null and clientcompanypropertyassignmentrevokeddate is null and clientcompanypropertyassignmentexpired is null and clientcompanypropertyid = ".db_number($clientcompanypropertyid); if (clientcompanyid()) $sql .= " and tblclientcompanyproperty.clientcompanyid = ".clientcompanyid(); else if (companyid()) $sql .= " and staffid in (select staffid from tbllogin where companyid = (select companyid from tbllogin where loginid = ".loginid().") and staffid > 0)"; else if (accountid()) $sql .= " and accountstaffid in (select accountstaffid from tbllogin where accountid = (select accountid from tbllogin where accountstaffid = ".accountstaffid().") and accountstaffid > 0)"; else return array(); $agentarr = db_query($sql); $returnarr = array(); if (is_array($agentarr) && !empty($agentarr)) foreach ($agentarr as $k=>$agent) { $tmparr[id] = $agent[clientcompanypropertyassignmentid]; $tmparr[value] = "$agent[assignmentmethodname] - $agent[name]"; $returnarr[] = $tmparr; } if (is_developer()) { $returnarr_sqlqry[sql] = $sql; $returnarr_sqlqry[qry] = $returnarr; d(expense_listofagentsforproperty, $returnarr_sqlqry); } return $returnarr; } function expense_getmonths() { $a = array(); $a[1] = "January"; $a[2] = "February"; $a[3] = "March"; $a[4] = "April"; $a[5] = "May"; $a[6] = "June"; $a[7] = "July"; $a[8] = "August"; $a[9] = "September"; $a[10] = "October"; $a[11] = "November"; $a[12] = "December"; return $a; } function expense_getdays() { return array(); } function expense_getrecurringselectbox($mastercexpenseid, $selected = '') { //If you change this, you'll also need to update javascription function insertnew in _expenses.php $out = ""; $out .= ""; if ($selected) $out = str_replace("