X-Git-Url: https://jasonwoof.com/gitweb/?p=contractor-progress.git;a=blobdiff_plain;f=index.php;h=46a27e3238c3ccde6e700bff1f12bc5a7f0631b2;hp=d87d74fec99f40681f5b8c92e49b4d3b697b9257;hb=a8968f20cd3b06b2cc19de6871019d4aaae6b79b;hpb=1bcde3c6ba88a93deaa0848df4de0b0857d9bf49 diff --git a/index.php b/index.php index d87d74f..46a27e3 100644 --- a/index.php +++ b/index.php @@ -2,10 +2,6 @@ require_once('code/tasks.php'); -function enc_money($float) { - return format_money($float, $cents = true); -} - function index_main() { if(!logged_in()) { return 'login'; @@ -22,7 +18,6 @@ function task_summary($tem_prefix, $where_clause/*, ... */) { $args = func_get_args(); $args = array_slice($args, 1); array_unshift($args, 'tasks', 'id,price,title,state,client_id'); - print_r($args); $rows = call_user_func_array('db_get_rows', $args); #$rows = db_get_rows('tasks', 'id,price,title,state,client_id', $where_clause); if($rows) { @@ -48,18 +43,31 @@ function task_summary($tem_prefix, $where_clause/*, ... */) { function _index_main() { $client_id = logged_in(); + + # make sure they've filled out the tiny user agreement + $tiny_agreement = db_get_value('people', 'tiny_agreement', 'where id=%i', $client_id); + if($tiny_agreement < 30) { + return './tiny_agreement'; + } + if(logged_in_as_contractor()) { - task_summary('needs_attention', 'where state=%i || state=%i || state=%i order by id desc', TASK_NEEDS_QUOTE, TASK_WORKING, TASK_BUG); + tem_show('needs_attention_header'); + task_summary('needs_approval', 'where state=%i order by id desc', TASK_WORKING); + task_summary('needs_fixing', 'where state=%i || state=%i order by id desc', TASK_NEEDS_QUOTE, TASK_BUG); task_summary('finished_unpaid', 'where state=%i && paid = 0 order by id desc', TASK_FINISHED); task_summary('finished_paid', 'where state=%i && paid = 1 order by id desc', TASK_FINISHED); + task_summary('queue', 'where state=%i order by client_id, ord', TASK_QUEUED); } else { - task_summary('needs_attention', 'where state=' . TASK_DRAFT . ' || state=' . TASK_NEEDS_CLARIFICATION . ' || state=' . TASK_NEEDS_GO_AHEAD . ' || state=' . TASK_NEEDS_TESTING . ' order by id'); - task_summary('queue', 'where state=' . TASK_QUEUED . " && client_id=$client_id order by ord"); - task_summary('jason', 'where state=' . TASK_NEEDS_QUOTE . ' || state=' . TASK_WORKING . ' || state=' . TASK_BUG . ' order by id desc'); - #task_summary('jason_pricing', 'where state=' . TASK_NEEDS_QUOTE . ' order by id desc'); - #task_summary('jason_working', 'where state=' . TASK_WORKING . ' order by id desc'); - task_summary('finished_unpaid', 'where state=' . TASK_FINISHED . ' && paid = 0 order by id desc'); - task_summary('finished_paid', 'where state=' . TASK_FINISHED . ' && paid = 1 order by id desc'); + if(db_count('tasks', 'where client_id=%i && (state=%i || state=%i || state=%i || state=%i)', $client_id, TASK_DRAFT, TASK_NEEDS_CLARIFICATION, TASK_NEEDS_GO_AHEAD, TASK_NEEDS_TESTING)) { + tem_show('needs_attention_header'); + task_summary('needs_approval', 'where client_id=%i && (state=%i || state=%i) order by id', $client_id, TASK_NEEDS_GO_AHEAD, TASK_NEEDS_TESTING); + task_summary('needs_fixing', 'where client_id=%i && (state=%i || state=%i) order by id', $client_id, TASK_DRAFT, TASK_NEEDS_CLARIFICATION); + } + task_summary('queue', 'where client_id=%i && state=%i order by ord', $client_id, TASK_QUEUED); + task_summary('jason', 'where client_id=%i && (state=%i || state=%i) order by id desc', $client_id, TASK_NEEDS_QUOTE, TASK_BUG); + task_summary('jason_working', 'where client_id=%i && state=%i order by id desc', $client_id, TASK_WORKING); + task_summary('finished_unpaid', 'where client_id=%i && state=%i && paid=0 order by id desc', $client_id, TASK_FINISHED); + task_summary('finished_paid', 'where client_id=%i && state=%i && paid=1 order by id desc', $client_id, TASK_FINISHED); } return; }