/** * 插入客户项目关联表 * @param $CstGUID * @param $project * @return bool */ function biz_insertCstAttach($CstGUID, $project) { global $_W; $item = db_getCstAttach($project['projguid'], $CstGUID); if (empty($item)) { $data = array('CstGUID' => $CstGUID, 'ProjGUID' => $project['projguid'], 'BUGUID' => $project['BUGUID'], 'USERGUID' => $_W['uid'], 'CstAttachGUID' => GUID()); $state = pdo_insert('p_cstattach', $data); return $state; } else { return false; } }
function download_chips($guid, $clear = false) { $rows = db_getChipsByProj($guid); foreach ($rows as &$r) { unset($r['id']); } unset($r); $res[] = array('table' => 'chips', 'key' => 'qrcode', 'rows' => $rows, 'clear' => array('ProjGUID' => $guid)); $res[] = array('table' => 'bill', 'key' => 'BillGUID', 'rows' => db_getBills($guid), 'clear' => array('ProjGUID' => $guid)); $res[] = array('table' => 's_fee', 'key' => 'FeeGUID', 'rows' => db_getFees($guid), 'clear' => array('ProjGUID' => $guid)); $res[] = array('table' => 'p_cstattach', 'key' => 'CstAttachGUID', 'rows' => db_getCstAttach($guid), 'clear' => array('ProjGUID' => $guid)); $res[] = array('table' => 'p_customer', 'key' => 'CstGUID', 'rows' => db_getCustomers($guid)); $invoices = db_getInvoices($guid); $res[] = array('table' => 'p_invoice', 'key' => 'InvoGUID', 'rows' => $invoices, 'clear' => array('ProjGUID' => $guid), 'clearchild' => array('p_invoicedetail')); $InvoiceDetails = array(); foreach ($invoices as $i) { $InvoiceDetails = array_merge($InvoiceDetails, db_getInvoiceDetails($i['InvoGUID'])); } $res[] = array('table' => 'p_invoicedetail', 'key' => 'InvoDetailGUID', 'rows' => $InvoiceDetails); unset($invoices); return $res; }