Commit 775f3c44 by lizhilin

更新

parent ab67e1cc
...@@ -4,6 +4,8 @@ ...@@ -4,6 +4,8 @@
use App\Admin\Repositories\Lawyer; use App\Admin\Repositories\Lawyer;
use App\Models\Lawyer as ModelLawyer; use App\Models\Lawyer as ModelLawyer;
use App\Models\Covenant as ModelCovenant;
use App\Models\CovenantReceivePayment as ModelCovenantReceivePayment;
use Dcat\Admin\Form; use Dcat\Admin\Form;
use Dcat\Admin\Grid; use Dcat\Admin\Grid;
use Dcat\Admin\Show; use Dcat\Admin\Show;
...@@ -133,4 +135,17 @@ public static function getRandNumber() ...@@ -133,4 +135,17 @@ public static function getRandNumber()
} while ($flag < 1); } while ($flag < 1);
return $rndnumber; return $rndnumber;
} }
public function destroy($id)
{
$res = $this->form()->destroy($id);
if ($res) {
//合同信息
ModelCovenant::where('lawyer_id', $id)->delete();
//收款开票信息
ModelCovenantReceivePayment::where('lawyer_id', $id)->delete();
}
return $res;
}
} }
...@@ -84,7 +84,8 @@ public function getList(array $param) ...@@ -84,7 +84,8 @@ public function getList(array $param)
->select(DB::raw('rp.cid, c.cname,c.ctype,c.number as cnum,c.principal,c.principal_id,l.number as lnum,l.name as lname,sum(invoiced_money) as invoiced_money,sum(received_amount) as received_amount')) ->select(DB::raw('rp.cid, c.cname,c.ctype,c.number as cnum,c.principal,c.principal_id,l.number as lnum,l.name as lname,sum(invoiced_money) as invoiced_money,sum(received_amount) as received_amount'))
//->select(['rp.cid', 'c.cname', 'c.ctype', 'c.number as cnum', 'c.principal', 'l.number as lnum', 'l.name as lname', 'sum(invoiced_money) as invoiced_money']) //->select(['rp.cid', 'c.cname', 'c.ctype', 'c.number as cnum', 'c.principal', 'l.number as lnum', 'l.name as lname', 'sum(invoiced_money) as invoiced_money'])
->leftJoin('covenant as c', 'rp.cid', '=', 'c.id') ->leftJoin('covenant as c', 'rp.cid', '=', 'c.id')
->leftJoin('lawyer as l', 'rp.lawyer_id', '=', 'l.id'); ->leftJoin('lawyer as l', 'rp.lawyer_id', '=', 'l.id')
->whereNull('rp.deleted_at');
if ($invoiced_at['start'] && $received_at['start']) { if ($invoiced_at['start'] && $received_at['start']) {
$in_start = $invoiced_at['start'] ?? ''; $in_start = $invoiced_at['start'] ?? '';
......
...@@ -80,7 +80,8 @@ public function getList(array $param) ...@@ -80,7 +80,8 @@ public function getList(array $param)
$note_monitor = DB::table('covenant_receive_payment AS rp') $note_monitor = DB::table('covenant_receive_payment AS rp')
->select(DB::raw('rp.lawyer_id,rp.year,l.number as lnumber,l.name as lname,l.commission_rate,sum(invoiced_money) as invoiced_money,sum(received_amount) as received_amount')) ->select(DB::raw('rp.lawyer_id,rp.year,l.number as lnumber,l.name as lname,l.commission_rate,sum(invoiced_money) as invoiced_money,sum(received_amount) as received_amount'))
//->select(['rp.*', 'l.name as lname', 'l.number as lnumber', 'l.commission_rate']) //->select(['rp.*', 'l.name as lname', 'l.number as lnumber', 'l.commission_rate'])
->leftJoin('lawyer as l', 'rp.lawyer_id', '=', 'l.id'); ->leftJoin('lawyer as l', 'rp.lawyer_id', '=', 'l.id')
->whereNull('rp.deleted_at');
if ($number) { if ($number) {
$note_monitor = $note_monitor->where("l.number", $number); $note_monitor = $note_monitor->where("l.number", $number);
} }
......
...@@ -6,10 +6,12 @@ ...@@ -6,10 +6,12 @@
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\DB;
use Illuminate\Database\Eloquent\SoftDeletes;
class CovenantReceivePayment extends Model class CovenantReceivePayment extends Model
{ {
use HasDateTimeFormatter; use HasDateTimeFormatter;
use SoftDeletes;
protected $table = 'covenant_receive_payment'; protected $table = 'covenant_receive_payment';
//账户类型 //账户类型
......
...@@ -6,10 +6,12 @@ ...@@ -6,10 +6,12 @@
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\DB;
use Illuminate\Database\Eloquent\SoftDeletes;
class Lawyer extends Model class Lawyer extends Model
{ {
use HasDateTimeFormatter; use HasDateTimeFormatter;
use SoftDeletes;
protected $table = 'lawyer'; protected $table = 'lawyer';
//律师汇总表 总基本工资 //律师汇总表 总基本工资
...@@ -107,7 +109,8 @@ public static function getTotalInfo($params, $received_at, $invoiced_at) ...@@ -107,7 +109,8 @@ public static function getTotalInfo($params, $received_at, $invoiced_at)
$note_monitor = DB::table('covenant_receive_payment AS rp') $note_monitor = DB::table('covenant_receive_payment AS rp')
->select(DB::raw('rp.lawyer_id,rp.year,l.number as lnumber,l.name as lname,l.commission_rate,sum(invoiced_money) as invoiced_money,sum(received_amount) as received_amount')) ->select(DB::raw('rp.lawyer_id,rp.year,l.number as lnumber,l.name as lname,l.commission_rate,sum(invoiced_money) as invoiced_money,sum(received_amount) as received_amount'))
//->select(['rp.*', 'l.name as lname', 'l.number as lnumber', 'l.commission_rate']) //->select(['rp.*', 'l.name as lname', 'l.number as lnumber', 'l.commission_rate'])
->leftJoin('lawyer as l', 'rp.lawyer_id', '=', 'l.id'); ->leftJoin('lawyer as l', 'rp.lawyer_id', '=', 'l.id')
->whereNull('rp.deleted_at');
if ($lnum) { if ($lnum) {
$note_monitor = $note_monitor->where("l.number", $lnum); $note_monitor = $note_monitor->where("l.number", $lnum);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment