@php use App\Models\Profile; use App\Http\Controllers\Mod\ModOrigin; use App\Http\Controllers\Mod\ModPaymentMethodRecurrent; use App\Http\Controllers\Mod\ModSalesOrderPaymentMethod; use App\Http\Controllers\ModFinancial; // dd($record_report); @endphp
{{-- ORIGEM--}} {{-- TOTAL--}} {{-- BASE--}} {{-- FATURADO--}} {{-- PENDENTE--}} @foreach($record_report as $row) @php //TODAL $record_origin_total = ModOrigin::informationSalesOrderLast([ 'selectString'=>'idOrigin,idSalesOrder' , 'idOrigin' => $row->idOrigin, 'distinct'=>'on', // 'idSalesOrderStatus' => '9,3', //VENDAS REALIZADA 'dateRange'=> Request::input('dateRangeEdit'), 'dateRangeName' => 'clientAcceptedDate,sellerDate',// data de criação 'idUserResponsible'=> $row->idUserResponsible, 'orderByName'=> 'idSalesOrder', 'optionList'=>'g', 'optionListQtt'=>'a', ]); $count_total = count($record_origin_total,); $calc_value_pt = 0; $calc_value_rt=0; //FORMA DE PAGAMENTO: PADRAO $record_origin = ModOrigin::informationSalesOrderLast([ 'selectString'=>'idOrigin,idNegotiation,idSalesOrder,idPaymentMethod,idPaymentMethodRecurrent,shippingFee' , 'idOrigin' => $row->idOrigin, 'dateRange'=> Request::input('dateRangeEdit'), 'dateRangeName' => 'clientAcceptedDate,sellerDate', 'idUserResponsible'=>$row->idUserResponsible, 'idSalesOrderStatus' => '9', //VENDAS REALIZADA 'idPaymentMethod'=>1, 'optionList'=>'g', 'optionListQtt'=>'a', ]); $count=count($record_origin); $calc_value=0; foreach ($record_origin as $row_so){ //FORMA DE PAGMTO: PARCELADO $record_method = ModSalesOrderPaymentMethod::paymentMethod('0', $row_so->idSalesOrder); foreach ($record_method as $row_method) { $calc_value += isset($row_method->quotaValue) ? $row_method->quotaValue : 0; } } //FORMA DE PAGAMENTO: PADRAO $record_origin = ModOrigin::informationSalesOrderLast([ 'selectString'=>'idOrigin,idNegotiation,idSalesOrder,idPaymentMethod,idPaymentMethodRecurrent,shippingFee' , 'idOrigin' => $row->idOrigin, 'dateRange'=> Request::input('dateRangeEdit'), 'dateRangeName' => 'clientAcceptedDate,sellerDate', 'idUserResponsible'=>$row->idUserResponsible, 'idSalesOrderStatus' => '3', //PENDENTE 'idPaymentMethod'=>1, 'optionList'=>'g', 'optionListQtt'=>'a', ]); $count_pf=count($record_origin); $calc_value_pf=0; foreach ($record_origin as $row_so){ //FORMA DE PAGMTO: PARCELADO $record_method = ModSalesOrderPaymentMethod::paymentMethod('0', $row_so->idSalesOrder); foreach ($record_method as $row_method) { $calc_value_pf += isset($row_method->quotaValue) ? $row_method->quotaValue : 0; } } //------------------------------------------------------------------------------------ //FORMA DE PAGAMENTO: RECORRENTE $record_origin_r=ModOrigin::informationSalesOrderLast([ 'selectString'=>'idOrigin,idNegotiation,idSalesOrder,idPaymentMethod,idPaymentMethodRecurrent,shippingFee' , 'idOrigin' => $row->idOrigin, 'dateRange'=> Request::input('dateRangeEdit'), 'dateRangeName' => 'clientAcceptedDate,sellerDate', 'idUserResponsible'=>$row->idUserResponsible, 'idSalesOrderStatus' => '9', //VENDAS REALIZADA 'idPaymentMethod'=>2, 'optionList'=>'g', 'optionListQtt'=>'a', ]); $count_r=count($record_origin_r); $calc_value_r=0; foreach ($record_origin_r as $row_so){ $calc_value_r += $row_so->shippingFee; //Escolhe o metodo de pagamento //FORMA DE PAGMTO: RECORRENTE $record_value_rec = ModPaymentMethodRecurrent::information([ 'idSalesOrder' => $row_so->idSalesOrder, 'idStatusReg' => 1, 'sumValue' => 'on', 'groupBy' => 'idSalesOrder', ]); //METODO DE PAGAMENTO:: Se for anual divide por 12x $id_payment_method_recurrent = isset($record_value_rec->idPaymentMethodRecurrent) ? $record_value_rec->idPaymentMethodRecurrent : null; if($id_payment_method_recurrent == 4){ $method_value_r = floatval(isset($record_value_rec->value) ? $record_value_rec->value : 0); $method_value_r = $method_value_r/12; }else{ $method_value_r = floatval(isset($record_value_rec->value) ? $record_value_rec->value : 0); } //VALOR $calc_value_r += $method_value_r; } //------------------------------------------------------------------------------------ //PENDENTE //FORMA DE PAGAMENTO: RECORRENTE $record_origin_pr=ModOrigin::informationSalesOrderLast([ 'selectString'=>'idOrigin,idNegotiation,idSalesOrder,idPaymentMethod,idPaymentMethodRecurrent,shippingFee' , 'idOrigin' => $row->idOrigin, 'idSalesOrderStatus' => '3', //VENDAS REALIZADA 'idPaymentMethod'=>2, 'dateRange'=> Request::input('dateRangeEdit'), 'dateRangeName' => 'clientAcceptedDate,sellerDate', 'idUserResponsible'=>$row->idUserResponsible, 'optionList'=>'g', 'optionListQtt'=>'a', ]); $count_pr=count($record_origin_pr); $calc_value_pr=0; foreach ($record_origin_pr as $row_so){ $calc_value_pr += $row_so->shippingFee; //Escolhe o metodo de pagamento //FORMA DE PAGMTO: RECORRENTE $record_value_rec = ModPaymentMethodRecurrent::information([ 'idSalesOrder' => $row_so->idSalesOrder, 'idStatusReg' => 1, 'sumValue' => 'on', 'groupBy' => 'idSalesOrder', ]); //METODO DE PAGAMENTO:: Se for anual divide por 12x $id_payment_method_recurrent = isset($record_value_rec->idPaymentMethodRecurrent) ? $record_value_rec->idPaymentMethodRecurrent : null; if($id_payment_method_recurrent == 4){ $method_value_pr = floatval(isset($record_value_rec->value) ? $record_value_rec->value : 0); $method_value_pr = $method_value_pr/12; }else{ $method_value_pr = floatval(isset($record_value_rec->value) ? $record_value_rec->value : 0); } //VALOR $calc_value_pr += $method_value_pr; } @endphp @php $id=$row->idOrigin; @endphp @if($count_total >0) {{-- ORIGEM--}} {{-- TOTAL--}} {{-- BASE--}} {{-- FATURADO--}} {{-- PENDENTE--}} @endif @endforeach
Vendedores Qtdd % Qtdd Valor Qtdd Valor Qtdd Valor Qtdd Valor Qtdd Valor Qtdd Valor
@php $profile=Profile::user($row->idUserResponsible) @endphp {{$profile->userName}} {{$count_total}} {{-- {{--
{{print_r($record_origin_total)}}
--}}
{{-- {{$count+$count_pf+$count_r+$count_pr}}--}} @php $soma = $count+$count_pf+$count_r+$count_pr; $result=0; if($soma != 0) { if($count_total != 0) { $result=$soma*100; $result=$result/$count_total; } } echo ModFinancial::formatMoney( $result,'pt_BR').'%'; @endphp {{$count+$count_pf}} {{ModFinancial::formatMoney($calc_value+$calc_value_pf,'pt_BR')}} {{$count_r+$count_pr}} {{ModFinancial::formatMoney($calc_value_r+$calc_value_pr,'pt_BR')}} {{$count}} {{ModFinancial::formatMoney($calc_value,'pt_BR')}} {{$count_r}} {{ModFinancial::formatMoney($calc_value_r,'pt_BR')}} {{$count_pf}} {{ModFinancial::formatMoney($calc_value_pf,'pt_BR')}} {{$count_pr}} {{ModFinancial::formatMoney($calc_value_pr,'pt_BR')}}