Add invoice stuff.
このコミットが含まれているのは:
コミット
663b8b191f
|
@ -926,6 +926,45 @@ class InvoiceController extends Controller {
|
|||
}
|
||||
}
|
||||
|
||||
public function newInvoiceItem(Request $request) { // /api/rpc/invoice/invoices/newitem
|
||||
$check = $this->objAuth->checkLegit($request->username, $request->password);
|
||||
|
||||
if ($check == 0) {
|
||||
return 'Err!';
|
||||
}
|
||||
else {
|
||||
$valid = $this->objAuth->getPermissions($request->username, $request->password);
|
||||
|
||||
if ($valid['inv_makeinvoice'] == 1) {
|
||||
if ($valid['inv_manuser'] == 1) {
|
||||
DB::table('inv_invoice_items')
|
||||
->insert([
|
||||
'user_id' => $request->user_id,
|
||||
'invoice_id' => $request->inv,
|
||||
'service_id' => $request->service_id,
|
||||
'from_time' => $request->from_time,
|
||||
'to_time' => $request->to_time
|
||||
]);
|
||||
}
|
||||
else {
|
||||
DB::table('inv_invoice_items')
|
||||
->insert([
|
||||
'user_id' => $check,
|
||||
'invoice_id' => $request->inv,
|
||||
'service_id' => $request->service_id,
|
||||
'from_time' => $request->from_time,
|
||||
'to_time' => $request->to_time
|
||||
]);
|
||||
}
|
||||
|
||||
return 'Success!';
|
||||
}
|
||||
else {
|
||||
return 'Permission denied.';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function newInvoice(Request $request) { // /api/rpc/invoice/invoices/new
|
||||
$check = $this->objAuth->checkLegit($request->username, $request->password);
|
||||
|
||||
|
@ -945,21 +984,13 @@ class InvoiceController extends Controller {
|
|||
$add = DB::table('inv_invoices')
|
||||
->insertGetId([
|
||||
'user_id' => $request->user_id,
|
||||
'contact_id' => $request->contact_id,
|
||||
'customer' => $request->customer,
|
||||
'employer' => $request->employer,
|
||||
'year' => date('Y'),
|
||||
'inv_number' => $lastInv->inv_number + 1,
|
||||
'inv_number' => $lastInv + 1,
|
||||
'revision' => 0,
|
||||
'make_date' => time()
|
||||
]);
|
||||
|
||||
DB::table('inv_invoice_items')
|
||||
->insert([
|
||||
'user_id' => $request->user_id,
|
||||
'invoice_id' => $add,
|
||||
'service_id' => $request->service_id,
|
||||
'from_time' => $request->from_time,
|
||||
'to_time' => $request->to_time
|
||||
]);
|
||||
}
|
||||
else {
|
||||
$lastInv = DB::table('inv_invoices')
|
||||
|
@ -970,21 +1001,13 @@ class InvoiceController extends Controller {
|
|||
$add = DB::table('inv_invoices')
|
||||
->insertGetId([
|
||||
'user_id' => $check,
|
||||
'contact_id' => $request->contact_id,
|
||||
'customer' => $request->customer,
|
||||
'employer' => $request->employer,
|
||||
'year' => date('Y'),
|
||||
'inv_number' => $lastInv->inv_number + 1,
|
||||
'inv_number' => $lastInv + 1,
|
||||
'revision' => 0,
|
||||
'make_date' => time()
|
||||
]);
|
||||
|
||||
DB::table('inv_invoice_items')
|
||||
->insert([
|
||||
'user_id' => $check,
|
||||
'invoice_id' => $add,
|
||||
'service_id' => $request->service_id,
|
||||
'from_time' => $request->from_time,
|
||||
'to_time' => $request->to_time
|
||||
]);
|
||||
}
|
||||
|
||||
return $add;
|
||||
|
|
新しいイシューから参照