This commit is contained in:
Shohrat 2023-10-12 03:11:21 +05:00
parent 05e29a2ea3
commit a94a44e67a
17 changed files with 704 additions and 155 deletions

View File

@ -52,6 +52,8 @@ class Action extends ComponentBase
} elseif ($actionType == 'outbox') {
$qty = ActionModel::where("product_id", $data["product_id"])
->where("stock_id", $data["stock_id"])
->where("status_accountant", "accept")
->where("status_director", "accept")
->sum("amount");
// $productOutbox = ActionModel::where("product_id", $data["product_id"])
@ -65,7 +67,7 @@ class Action extends ComponentBase
$createResult = new ActionModel();
$createResult->product_id = $data["product_id"];
$createResult->type = 'outbox';
$createResult->quantity = -$data["quantity"];
$createResult->amount = -$data["quantity"];
$createResult->stock_id = $data["stock_id"];
$createResult->user_id = $user->id;
@ -74,11 +76,11 @@ class Action extends ComponentBase
// dd($data);
if ($createResult) {
Flash::success("Action Outbox Ustunlikli Goshuldy");
Flash::success("Harytlar sklatdan ustunlikli chykaryldy");
return Redirect::refresh();
}
} else {
Flash::error("Данного товара нет в наличии");
Flash::error("Bu mukdarda haryt ýok");
return Redirect::refresh();
}
}

View File

@ -14,6 +14,7 @@ use Redirect;
use Carbon\Carbon;
use Flash;
use DB;
use October\Rain\Support\Facades\Flash as FacadesFlash;
class Order extends ComponentBase
{
@ -37,16 +38,16 @@ class Order extends ComponentBase
$orders = OrderModel::with(["client", "shipping"])
->withCount(['order_items as order_all_amount' => function ($query) {
$query->select(DB::raw('sum(amount)'));
}])
->withCount(['order_items as order_all_price' => function ($query) {
$query->select(DB::raw('sum(price) * sum(amount)'));
}])
->withCount(['payment as all_payments' => function ($query) {
$query->select(DB::raw('sum(amount)'));
}])
->orderBy('id', 'DESC');
->withCount(['order_items as order_all_amount' => function ($query) {
$query->select(DB::raw('sum(amount)'));
}])
->withCount(['order_items as order_all_price' => function ($query) {
$query->select(DB::raw('sum(price) * sum(amount)'));
}])
->withCount(['payment as all_payments' => function ($query) {
$query->select(DB::raw('sum(amount)'));
}])
->orderBy('id', 'DESC');
$start = Carbon::parse($data["start"])->format('Y-m-d');
@ -64,18 +65,22 @@ class Order extends ComponentBase
$orders->where("note", "like", "%" . $note . "%");
}
if ($start != $currentDateFormat){
if ($start != $currentDateFormat) {
$orders->whereBetween('created_at', [$start, $end]);
}
$ordersFiltered = $orders->get();
$allPaid = 0;
$allNotPaid = 0;
$html_data = '';
for ($x = 0; $x < count($ordersFiltered); $x++) {
$status = '';
$allPaid += $ordersFiltered[$x]->all_payments;
$allNotPaid += ($ordersFiltered[$x]->order_all_price - $ordersFiltered[$x]->all_payments);
$html_data .= '<tr>
<td style="font-weight: bold;">' . ($x + 1) . '</td>
<td><a href="/order-detail/' . $ordersFiltered[$x]->id . '" style="font-weight: bold;">Sargyt #' . $ordersFiltered[$x]->id . '</a></td>
@ -99,7 +104,27 @@ class Order extends ComponentBase
if ($ordersFiltered) {
return [
'#orders_report_datas' => $html_data,
'#all_amount_report' => '
<div class="col-md-4">
<h3 class="card-title" style="font-size: 22px;color: #1e2038;">Sargytlar Boýunça Umumy</h3>
<p class="card-title-desc" style="color: #6c6ff5;">Hasabat</p>
</div>
<div class="col-md-4">
<div class="card bg-info text-white-50">
<div class="card-body">
<h5 class="text-white" style="text-transform: uppercase;margin-bottom: 0;"><i class="mdi mdi-bullseye-arrow me-3"></i> Jemi Tölenen: '.number_format($allPaid).' $</h5>
</div>
</div>
</div>
<div class="col-md-4">
<div class="card bg-danger text-white-50">
<div class="card-body">
<h5 class="text-white" style="text-transform: uppercase;margin-bottom: 0;"><i class="mdi mdi-bullseye-arrow me-3"></i> Jemi Bergiler: '.number_format($allNotPaid).' $</h5>
</div>
</div>
</div>
',
];
} else {
Flash::error("Yalnyshlyk bar!!");
@ -155,26 +180,26 @@ class Order extends ComponentBase
for ($x = 0; $x < count($shippingTransportsFiltered); $x++) {
$status = '';
if($shippingTransportsFiltered[$x]->status == "loaded"){
if ($shippingTransportsFiltered[$x]->status == "loaded") {
$status = '<span class="badge badge-soft-info"
style="font-size: 14px;">ÝÜKLENDI</span>';
}
if($shippingTransportsFiltered[$x]->status == "loading"){
if ($shippingTransportsFiltered[$x]->status == "loading") {
$status = '<span class="badge badge-soft-primary"
style="font-size: 14px;">ÝÜKLENÝÄR</span>';
}
if($shippingTransportsFiltered[$x]->status == "complated"){
if ($shippingTransportsFiltered[$x]->status == "complated") {
$status = '<span class="badge badge-soft-success"
style="font-size: 14px;">ÝERINE ÝETIRILDI</span>';
}
$html_data .= '<tr>
<td style="font-weight: bold;">' . ($x + 1) . '</td>
<td><a href="/order-detail/logistics/'.$shippingTransportsFiltered[$x]->shipping->order->id.'" style="font-weight: bold;">' . $shippingTransportsFiltered[$x]->transport_type . '</a></td>
<td><a href="/order-detail/logistics/' . $shippingTransportsFiltered[$x]->shipping->order->id . '" style="font-weight: bold;">' . $shippingTransportsFiltered[$x]->transport_type . '</a></td>
<td>' . $shippingTransportsFiltered[$x]->transport_no . '</td>
<td><a href="/order-detail/'.$shippingTransportsFiltered[$x]->shipping->order->id.'" style="font-weight: bold;">Sargyt #'.$shippingTransportsFiltered[$x]->shipping->order->id.'</a></td>
<td><a href="/order-detail/' . $shippingTransportsFiltered[$x]->shipping->order->id . '" style="font-weight: bold;">Sargyt #' . $shippingTransportsFiltered[$x]->shipping->order->id . '</a></td>
<td>' . $shippingTransportsFiltered[$x]->place_now . '</td>
<td><span class="badge badge-soft-success"
style="font-size: 14px;">' . $shippingTransportsFiltered[$x]->loaded_amount . ' kg</span>
@ -415,15 +440,191 @@ class Order extends ComponentBase
// }
}
public function onModalSetTransportChange()
{
$data = post();
$transports = ShippingTransportModel::where("status", "!=", "complated")->where("id", "!=", $data["transportId"])->with(["shipping.order.client"])->orderBy("id", "DESC")->get();
$transportItem = ShippingTransportModel::where("id", $data["transportId"])->first();
$html_data = '<div class="modal-header">
<h5 class="modal-title" id="mySmallModalLabel">Ýük geçirmek </h5>
<button type="button" class="btn-close" data-bs-dismiss="modal"
aria-label="Close"></button>
</div>
<div class="modal-body">
<form data-request="onUpdateTransportChange" method="POST" data-request-flash>
<div class="row">
<div class="col-md-12">
<label class="form-label">Ýüklenmeli Transport</label>
<select class="form-control select2" name="shipping_id">
<option value="0">Saýla</option>';
for ($x = 0; $x < count($transports); $x++) {
$transportTitle = "";
$transportType = $transports[$x]->transport_type;
if ($transportType == "truck") {
$transportTitle = "TYR";
}
if ($transportType == "train") {
$transportTitle = "WAGON";
}
$html_data .= '<option value="' . $transports[$x]->id . '">Sargyt #' . $transports[$x]->shipping->order->id . ' - ' . $transports[$x]->shipping->order->client->name . ' (' . $transportTitle . ' - ' . $transports[$x]->transport_no . ')</option>';
}
$html_data .= '</select>
</div>
<div class="col-md-12 mt-3">
<div>
<label class="form-label">Transport No</label>
<input type="text" name="transport_no" class="form-control"
placeholder="Transport No" value="' . $transportItem->transport_no . '">
</div>
</div>
<div class="col-md-12 mt-3">
<div>
<label class="form-label">Beýleki Transporta Ýüklenmeli Mukdar (kg)</label>
<input type="number" name="loaded_amount" step="0.01" class="form-control"
placeholder="Ýüklenen Mukdar (kg)" value="' . $transportItem->loaded_amount . '">
</div>
</div>
<div class="col-md-12 mt-3">
<div>
<label class="form-label">Bellik</label>
<input type="text" name="note" class="form-control"
placeholder="Bellik" value="' . $transportItem->note . '">
</div>
</div>
</div>
<input type="hidden" name="transport_id" value="' . $data["transportId"] . '">
<button type="submit" data-bs-dismiss="modal"
class="btn btn-primary waves-effect waves-light"
style="margin-top: 15px;width: 100%;">Üýtget</button>
</form>
</div>';
return [
'#modal-form' => $html_data,
];
}
public function onUpdateTransportChange()
{
$data = post();
$orderId = $this->param("orderId");
$orderq = OrderModel::where("id", $orderId)
->withCount(['order_items as order_all_amount' => function ($query) {
$query->select(DB::raw('sum(amount)'));
}])->first();
$transportAmountSum = ShippingTransportModel::where("shipping_id", $orderq->shipping_id)->sum('loaded_amount');
$allLoadedAmount = $transportAmountSum + $data["loaded_amount"];
// dd($allLoadedAmount);
// if ($orderq->order_all_amount < $allLoadedAmount) {
// Flash::error("Yuklenen mukdar jemi edilen sargytdan uly");
// } else {
if ($data["shipping_id"]) {
$createShippingTransport = ShippingTransportModel::where("id", $data["transport_id"])->first();
$createShippingTransport->loaded_amount = ((float) $createShippingTransport->loaded_amount - (float) $data["loaded_amount"]);
$changedShippingTransport = ShippingTransportModel::where("id", $data["shipping_id"])->first();
$changedShippingTransport->loaded_amount = ((float) $data["loaded_amount"] + (float) $changedShippingTransport->loaded_amount);
$changedShippingTransport->note = $data["note"];
$changedShippingTransport->transport_no = $data["transport_no"];
$changedShippingTransport->save();
$createShippingTransport->save();
$html_data = '';
$transportDatas = ShippingTransportModel::where("shipping_id", $orderq->shipping_id)->orderBy('id', 'DESC')->get();
for ($x = 0; $x < count($transportDatas); $x++) {
// dd($orderDatas[$x]->shipping->status);
$html_data .= '<tr>
<td style="font-weight: bold;">' . ($x + 1) . '</td>
<td><a href="#" style="font-weight: bold;">' . $transportDatas[$x]->transport_type . '</a></td>
<td>' . $transportDatas[$x]->place_now . '</td>
<td>' . $transportDatas[$x]->loaded_amount . ' kg</td>
<td>' . $transportDatas[$x]->transport_no . '</td>
<td>' . Carbon::parse($transportDatas[$x]->date)->format('d.m.Y') ?? " " . '</td>';
$html_data .= '<td>' . $transportDatas[$x]->note . '</td>
<td>' . $transportDatas[$x]->status . '</td>';
if ($transportDatas[$x]->status == "complated") {
$html_data .= '<td><a href="#" style="color: darkgreen;"> ' . $transportDatas[$x]->status . ' </a></td>';
} else {
$html_data .= '<td><a href="#" data-request="onModalSetTransportChange"
data-request-data="transportId: ' . $transportDatas[$x]->id . '"
data-bs-toggle="modal" data-bs-target=".bs-example-modal-sm-1" style="color: orange;"> Çalyşmak </a></td>';
}
$html_data .= '<td><a href="#" data-request="onModalSetTransport"
data-request-data="transportId: ' . $transportDatas[$x]->id . '"
data-bs-toggle="modal" data-bs-target=".bs-example-modal-sm-1" style="color: orange;"> Täzele </a></td>
</tr>';
}
$order = OrderModel::where("id", $orderId)->with(["client", "shipping"])
->withCount(['order_items as order_all_amount' => function ($query) {
$query->select(DB::raw('sum(amount)'));
}])
->withCount(['order_items as order_all_price' => function ($query) {
$query->select(DB::raw('sum(price)'));
}])
->first();
$all = ($order->order_all_amount * $order->order_all_price);
$allLoaded = ShippingTransportModel::where("shipping_id", $orderq->shipping_id)->sum("loaded_amount");
if ($createShippingTransport) {
Flash::success("Transport Ustunlikli Goşuldy");
return [
'#transport_item_datas' => $html_data,
'#allAmount' => $order->order_all_amount . " kg",
'#allPrice' => $order->order_all_price . " $",
'#all' => "Jemi Bahasy: " . number_format($all, 2) . " $",
'#all_loaded' => "Jemi Ýüklenen Ýük: " . number_format($allLoaded, 2) . " kg",
];
} else {
return Flash::error("Yalnyshlyk bar!!");
}
} else {
Flash::error("Ýüklenmeli Transport Saýlaň!");
}
// }
}
public function onModalSetTransport()
{
$data = post();
$orders = OrderModel::where("status", "new")->get();
$transportItem = ShippingTransportModel::where("id", $data["transportId"])->first();
$html_data = '<div class="modal-header">
<h5 class="modal-title" id="mySmallModalLabel">Transport Maglumatlaryny Üytegt</h5>
<h5 class="modal-title" id="mySmallModalLabel">Transport Maglumatlaryny Üytget</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal"
aria-label="Close"></button>
</div>
@ -453,6 +654,18 @@ class Order extends ComponentBase
</select>
</div>
<div class="col-md-12 mt-3">
<div>
<label class="form-label">Ugramaly Senesi</label>
<div class="input-group" id="datepicker2">
<input type="text" class="form-control" placeholder="d.m.Y"
data-date-format="d.m.yyyy" data-date-container="#datepicker2" data-provide="datepicker"
data-date-autoclose="true" name="date" value="' . (Carbon::parse($transportItem->date)->format('d.m.Y')) . '">
<span class="input-group-text"><i class="mdi mdi-calendar"></i></span>
</div>
</div>
</div>
<div class="col-md-12 mt-3">
<div>
<label class="form-label">Ýüklenen Mukdar (kg)</label>
@ -496,6 +709,8 @@ class Order extends ComponentBase
];
}
public function onUpdateTransportItem()
{
$data = post();
@ -520,6 +735,7 @@ class Order extends ComponentBase
$createShippingTransport->place_now = $data["place_now"];
$createShippingTransport->loaded_amount = $data["loaded_amount"];
$createShippingTransport->transport_no = $data["transport_no"];
$createShippingTransport->date = Carbon::parse($data["date"])->format('Y-m-d');
$createShippingTransport->status = $data["status"];
$createShippingTransport->note = $data["note"];
$createShippingTransport->shipping_id = $orderq->shipping_id;
@ -537,8 +753,19 @@ class Order extends ComponentBase
<td>' . $transportDatas[$x]->place_now . '</td>
<td>' . $transportDatas[$x]->loaded_amount . ' kg</td>
<td>' . $transportDatas[$x]->transport_no . '</td>
<td>' . $transportDatas[$x]->note . '</td>
<td><a href="#" data-request="onModalSetTransport"
<td>' . Carbon::parse($transportDatas[$x]->date)->format('d.m.Y') ?? " " . '</td>';
$html_data .= '<td>' . $transportDatas[$x]->note . '</td>
<td>' . $transportDatas[$x]->status . '</td>';
if ($transportDatas[$x]->status == "complated") {
$html_data .= '<td><a href="#" style="color: darkgreen;"> ' . $transportDatas[$x]->status . ' </a></td>';
} else {
$html_data .= '<td><a href="#" data-request="onModalSetTransportChange"
data-request-data="transportId: ' . $transportDatas[$x]->id . '"
data-bs-toggle="modal" data-bs-target=".bs-example-modal-sm-1" style="color: orange;"> Çalyşmak </a></td>';
}
$html_data .= '<td><a href="#" data-request="onModalSetTransport"
data-request-data="transportId: ' . $transportDatas[$x]->id . '"
data-bs-toggle="modal" data-bs-target=".bs-example-modal-sm-1" style="color: orange;"> Täzele </a></td>
</tr>';
@ -564,8 +791,8 @@ class Order extends ComponentBase
'#transport_item_datas' => $html_data,
'#allAmount' => $order->order_all_amount . " kg",
'#allPrice' => $order->order_all_price . " $",
'#all' => "Jemi Bahasy: " . number_format($all) . " $",
'#all_loaded' => "Jemi Ýüklenen Ýük: " . number_format($allLoaded) . " kg",
'#all' => "Jemi Bahasy: " . number_format($all, 2) . " $",
'#all_loaded' => "Jemi Ýüklenen Ýük: " . number_format($allLoaded, 2) . " kg",
];
} else {
return Flash::error("Yalnyshlyk bar!!");
@ -613,8 +840,19 @@ class Order extends ComponentBase
<td>' . $transportDatas[$x]->place_now . '</td>
<td>' . $transportDatas[$x]->loaded_amount . ' kg</td>
<td>' . $transportDatas[$x]->transport_no . '</td>
<td>' . $transportDatas[$x]->note . '</td>
<td><a href="#" data-request="onModalSetTransport"
<td>' . Carbon::parse($transportDatas[$x]->date)->format('d.m.Y') ?? " " . '</td>';
$html_data .= '<td>' . $transportDatas[$x]->note . '</td>
<td>' . $transportDatas[$x]->status . '</td>';
if ($transportDatas[$x]->status == "complated") {
$html_data .= '<td><a href="#" style="color: darkgreen;"> ' . $transportDatas[$x]->status . ' </a></td>';
} else {
$html_data .= '<td><a href="#" data-request="onModalSetTransportChange"
data-request-data="transportId: ' . $transportDatas[$x]->id . '"
data-bs-toggle="modal" data-bs-target=".bs-example-modal-sm-1" style="color: orange;"> Çalyşmak </a></td>';
}
$html_data .= '<td><a href="#" data-request="onModalSetTransport"
data-request-data="transportId: ' . $transportDatas[$x]->id . '"
data-bs-toggle="modal" data-bs-target=".bs-example-modal-sm-1" style="color: orange;"> Täzele </a></td>
</tr>';
@ -640,8 +878,8 @@ class Order extends ComponentBase
'#transport_item_datas' => $html_data,
'#allAmount' => $order->order_all_amount . " kg",
'#allPrice' => $order->order_all_price . " $",
'#all' => "Jemi Bahasy: " . number_format($all) . " $",
'#all_loaded' => "Jemi Ýüklenen Ýük: " . number_format($allLoaded) . " kg",
'#all' => "Jemi Bahasy: " . number_format($all, 2) . " $",
'#all_loaded' => "Jemi Ýüklenen Ýük: " . number_format($allLoaded, 2) . " kg",
];
} else {
return Flash::error("Yalnyshlyk bar!!");

View File

@ -36,97 +36,104 @@ class Production extends ComponentBase
$data = post();
$productions = ProductionModel::with(['pivot_production', 'excruiter', 'shift'])->orderBy('id', 'DESC');
$productionsCalc = ProductionModel::orderBy('id', 'DESC');
$start = Carbon::parse($data["start"])->format('Y-m-d');
$end = Carbon::parse($data["end"])->format('Y-m-d');
$startView = Carbon::parse($data["start"])->format('d.m.Y');
$endView = Carbon::parse($data["end"])->format('d.m.Y');
$excruiter = $data["excruiter_id"];
$shiftId = $data["shift_id"];
if ($start == $currentDateFormat) {
Flash::error("Sene Saylan!");
} else {
$startView = Carbon::parse($data["start"])->format('d.m.Y');
$endView = Carbon::parse($data["end"])->format('d.m.Y');
$excruiter = $data["excruiter_id"];
$shiftId = $data["shift_id"];
if ($excruiter) {
$productions->where("excruiter_id", $excruiter);
$productionsCalc->where("excruiter_id", $excruiter);
}
if ($excruiter) {
$productions->where("excruiter_id", $excruiter);
$productionsCalc->where("excruiter_id", $excruiter);
}
if ($shiftId) {
$productions->where("shift_id", $shiftId);
$productionsCalc->where("shift_id", $shiftId);
}
if ($shiftId) {
$productions->where("shift_id", $shiftId);
$productionsCalc->where("shift_id", $shiftId);
}
if ($start != $currentDateFormat) {
$productions->whereBetween('created_at', [$start, $end]);
if ($start != $currentDateFormat) {
$productions->whereBetween('created_at', [$start, $end]);
$calc = $productionsCalc->select(DB::raw('MAX(all_amount) - MIN(all_amount) AS amount_subtraction'), DB::raw('MAX(all_amount) AS max_amount'), DB::raw('MIN(all_amount) AS min_amount'), DB::raw('MAX(time) AS max_time'), DB::raw('MIN(time) AS min_time'))
->whereBetween('created_at', [$start, $end])->first();
$calc = $productionsCalc->select(DB::raw('MAX(all_amount) - MIN(all_amount) AS amount_subtraction'), DB::raw('MAX(all_amount) AS max_amount'), DB::raw('MIN(all_amount) AS min_amount'), DB::raw('MAX(time) AS max_time'), DB::raw('MIN(time) AS min_time'))
->whereBetween('created_at', [$start, $end])->first();
$diffMinutes = Carbon::parse($calc->max_time)->diffInMinutes($calc->min_time);
$calcTimeDiff = floor($diffMinutes / 60) . ' sagat ' . ($diffMinutes - floor($diffMinutes / 60) * 60) . ' minut';
// dd($max);
// $min = $productions->select(DB::raw("MIN(id)"));
$diffMinutes = Carbon::parse($calc->max_time)->diffInMinutes($calc->min_time);
$calcTimeDiff = floor($diffMinutes / 60) . ' sagat ' . ($diffMinutes - floor($diffMinutes / 60) * 60) . ' minut';
// dd($max);
// $min = $productions->select(DB::raw("MIN(id)"));
}
}
$productionsFiltered = $productions->get();
$productionsFiltered = $productions->get();
$html_data = '';
for ($x = 0; $x < count($productionsFiltered); $x++) {
// dd($productionsFiltered[0]->shift->desc);
$html_data .= '<tr>
<td style="font-weight: bold;width: 5%;">' . ($x+1) . '</td>
<td><a href="#" style="font-weight: bold;color: #0005c5;">' . $productionsFiltered[$x]->created_at->format("d.m.Y | H:i") . '</a></td>
<td><a href="#" style="font-weight: bold;color: #1e2038;">' . $productionsFiltered[$x]->shift->desc . '</a></td>
<td style="text-align: center;">
<span class="badge badge-soft-info"
style="font-size: 14px;">' . $productionsFiltered[$x]->excruiter->name . '</span>
</td>
<td style="text-align: center;">
<span class="badge badge-soft-success"
style="font-size: 14px;">' . number_format($productionsFiltered[$x]->all_amount) . ' kg</span>
</td>';
$html_data = '';
for ($x = 0; $x < count($productionsFiltered); $x++) {
// dd($productionsFiltered[0]->shift->desc);
$html_data .= '<tr>
<td style="font-weight: bold;width: 5%;">' . ($x + 1) . '</td>
<td><a href="#" style="font-weight: bold;color: #0005c5;">' . $productionsFiltered[$x]->created_at->format("d.m.Y | H:i") . '</a></td>
<td><a href="#" style="font-weight: bold;color: #1e2038;">' . $productionsFiltered[$x]->shift->desc . '</a></td>
<td style="text-align: center;">
<span class="badge badge-soft-info"
style="font-size: 14px;">' . $productionsFiltered[$x]->excruiter->name . '</span>
</td>
<td style="text-align: center;">
<span class="badge badge-soft-success"
style="font-size: 14px;">' . number_format($productionsFiltered[$x]->all_amount) . ' kg</span>
</td>';
for ($i = 0; $i < count($productionsFiltered[$x]->pivot_production); $i++) {
$html_data .= '<td> <a href="#">'.number_format($productionsFiltered[$x]->pivot_production[$i]->amount_percentage).'% </a></td>';
$html_data .= '<td> <a href="#">' . number_format($productionsFiltered[$x]->pivot_production[$i]->amount_percentage) . '% </a></td>';
}
$html_data .= '<td style="font-weight: bold;color: #0005c5;">' . $productionsFiltered[$x]->note . '</td>
</tr>';
}
$html_data .= '<td style="font-weight: bold;color: #0005c5;">' . $productionsFiltered[$x]->note . '</td>
</tr>';
}
if ($productionsFiltered) {
return [
'#production_report_datas' => $html_data,
// '#exampleModalFullscreenLabel' => '<font style="color: darkgreen;text-decoration: underline;font-weight: bold;">'. $startView .' - '. $endView .'</font> seneleri aralygynda güni jemi',
'#report_dynamic' => ' <div class="col-md-4">
<h3 class="card-title" style="font-size: 22px;color: #1e2038;">Çig Mallar Boýunça Umumy</h3>
<p class="card-title-desc" style="color: #6c6ff5;">Hasabat</p>
if ($productionsFiltered) {
return [
'#production_report_datas' => $html_data,
// '#exampleModalFullscreenLabel' => '<font style="color: darkgreen;text-decoration: underline;font-weight: bold;">'. $startView .' - '. $endView .'</font> seneleri aralygynda güni jemi',
'#report_dynamic' => ' <div class="col-md-4">
<h3 class="card-title" style="font-size: 22px;color: #1e2038;">Çig Mallar Boýunça Umumy</h3>
<p class="card-title-desc" style="color: #6c6ff5;">Hasabat</p>
</div>
<div class="col-md-4">
<div class="card bg-info text-white-50">
<div class="card-body">
<h5 class="text-white" style="text-transform: uppercase;margin-bottom: 0;"><i class="mdi mdi-bullseye-arrow me-3"></i>Sarp Edilen Wagt: ' . $calcTimeDiff . ' sany</h5>
</div>
</div>
</div>
<div class="col-md-4">
<div class="card bg-info text-white-50">
<div class="card-body">
<h5 class="text-white" style="text-transform: uppercase;margin-bottom: 0;"><i class="mdi mdi-bullseye-arrow me-3"></i>Sarp Edilen Wagt: '.$calcTimeDiff.' sany</h5>
<div class="card bg-info text-white-50">
<div class="card-body">
<h5 class="text-white" style="text-transform: uppercase;margin-bottom: 0;"><i class="mdi mdi-bullseye-arrow me-3"></i>Sarp Edilen Çig mal: ' . number_format($calc->amount_subtraction) . ' kg</h5>
</div>
</div>
</div>
</div>
<div class="col-md-4">
<div class="card bg-info text-white-50">
<div class="card-body">
<h5 class="text-white" style="text-transform: uppercase;margin-bottom: 0;"><i class="mdi mdi-bullseye-arrow me-3"></i>Sarp Edilen Çig mal: '.number_format($calc->amount_subtraction).' kg</h5>
</div>
</div>
</div>
'
];
} else {
Flash::error("Yalnyshlyk bar!!");
'
];
} else {
Flash::error("Yalnyshlyk bar!!");
}
}
}
@ -343,7 +350,7 @@ class Production extends ComponentBase
// ->distinct()
->get();
// dd($currentDateShifts);
// dd($currentDateShifts);
// $products = ProductModel::where("report", "simple")->get();
@ -385,8 +392,8 @@ class Production extends ComponentBase
<td style="font-weight: bold;color: #0005c5;">' . $currentDateShifts[$i]->shift->desc . '(' . $currentDateShifts[$i]->shift->start . ' - ' . $currentDateShifts[$i]->shift->end . ')</td>
<td><span class="badge badge-soft-info"
style="font-size: 14px;">' . $currentDateShifts[$i]->excruiter->name . '</span></td>
<td>'.$hourCountShift.'</td>
<td>'.$calc->amount_subtraction.' kg</td>';
<td>' . $hourCountShift . '</td>
<td>' . $calc->amount_subtraction . ' kg</td>';
// for ($x = 0; $x < count($pivotShiftLasts); $x++) {

View File

@ -0,0 +1,23 @@
<?php namespace Romanah\Gokbakja\Updates;
use Schema;
use October\Rain\Database\Updates\Migration;
class BuilderTableUpdateRomanahGokbakjaOrder6 extends Migration
{
public function up()
{
Schema::table('romanah_gokbakja_order', function($table)
{
$table->string('status')->default('new');
});
}
public function down()
{
Schema::table('romanah_gokbakja_order', function($table)
{
$table->dropColumn('status');
});
}
}

View File

@ -0,0 +1,23 @@
<?php namespace Romanah\Gokbakja\Updates;
use Schema;
use October\Rain\Database\Updates\Migration;
class BuilderTableUpdateRomanahGokbakjaShippingTransport4 extends Migration
{
public function up()
{
Schema::table('romanah_gokbakja_shipping_transport', function($table)
{
$table->date('date')->nullable();
});
}
public function down()
{
Schema::table('romanah_gokbakja_shipping_transport', function($table)
{
$table->dropColumn('date');
});
}
}

View File

@ -195,3 +195,9 @@
1.0.66:
- 'Updated table romanah_gokbakja_shipping_transport'
- builder_table_update_romanah_gokbakja_shipping_transport_3.php
1.0.67:
- 'Updated table romanah_gokbakja_shipping_transport'
- builder_table_update_romanah_gokbakja_shipping_transport_4.php
1.0.68:
- 'Updated table romanah_gokbakja_order'
- builder_table_update_romanah_gokbakja_order_6.php

View File

@ -65,6 +65,19 @@ items:
isHidden: '0'
cssClass: ''
isExternal: '0'
-
title: 'Haryt Çykarmak'
nesting: null
type: url
url: /product/actions/outbox
code: ''
reference: null
cmsPage: null
replace: null
viewBag:
isHidden: '0'
cssClass: ''
isExternal: '0'
-
title: 'Çig mallar boýunça'
nesting: null
@ -173,9 +186,13 @@ items:
isExternal: '0'
-
title: 'Aýlar boýunça'
nesting: null
type: cms-page
url: null
code: ''
reference: machine/report-production-machine
cmsPage: null
replace: null
viewBag:
isHidden: '0'
cssClass: ''
@ -222,18 +239,26 @@ items:
isExternal: '0'
-
title: Hasabat
nesting: null
type: cms-page
url: null
code: ''
reference: sewer/report
cmsPage: null
replace: null
viewBag:
isHidden: '0'
cssClass: ''
isExternal: '0'
-
title: 'Aýlar boýunça'
nesting: null
type: cms-page
url: null
code: ''
reference: sewer/month
cmsPage: null
replace: null
viewBag:
isHidden: '0'
cssClass: ''
@ -278,6 +303,15 @@ items:
isHidden: '0'
cssClass: ''
isExternal: '0'
-
title: Tölegler
type: cms-page
code: ''
reference: orders/payment-report
viewBag:
isHidden: '1'
cssClass: ''
isExternal: '0'
-
title: Hasabat
nesting: null

View File

@ -131,7 +131,7 @@ function onStart(){
<div class="row">
<div class="col-md-6">
<h3 class="card-title" style="font-size: 22px;color: #1e2038;">Sargyt Logistika Maglumatlary</h3>
<p class="card-title-desc" style="color: #6c6ff5;font-size: 17px;" id="all_loaded">Jemi Ýüklenen Ýük: {{allLoaded|number_format}} kg</p>
<p class="card-title-desc" style="color: #6c6ff5;font-size: 17px;" id="all_loaded">Jemi Ýüklenen Ýük: {{allLoaded|number_format(2)}} kg</p>
</div>
<div class="col-md-6" style="text-align: right;">
<a class="btn btn-primary" data-bs-toggle="collapse" href="#multiCollapseExample1"
@ -150,7 +150,10 @@ function onStart(){
<th>Şu wagtky ýeri</th>
<th>Ýüklenen Mukdar</th>
<th>Transport No</th>
<th>Ugramaly Sene</th>
<th>Bellik</th>
<th>Statusy</th>
<th>Ýük Çalyşmak</th>
<th>Sazlamalar</th>
</tr>
</thead>
@ -162,7 +165,18 @@ function onStart(){
<td>{{transport.place_now}}</td>
<td>{{transport.loaded_amount}} kg</td>
<td>{{transport.transport_no}}</td>
<td>{% if transport.date %}{{transport.date|date('d.m.Y')}}{% endif %}</td>
<td>{{transport.note}}</td>
<td style="font-weight: bold;color: #6c6ff5;">{{transport.status}}</td>
<td>
{% if transport.status == "complated" %}
<a href="#" style="color: darkgreen;"> {{transport.status}} </a>
{% else %}
<a href="#" data-request="onModalSetTransportChange"
data-request-data="transportId: {{transport.id}}"
data-bs-toggle="modal" data-bs-target=".bs-example-modal-sm-1" style="color: orange;"> Çalyşmak </a>
{% endif %}
</td>
<td><a href="#" data-request="onModalSetTransport"
data-request-data="transportId: {{transport.id}}"
data-bs-toggle="modal" data-bs-target=".bs-example-modal-sm-1" style="color: orange;"> Täzele </a></td>
@ -176,7 +190,10 @@ function onStart(){
<th>Şu wagtky ýeri</th>
<th>Ýüklenen Mukdar</th>
<th>Transport No</th>
<th>Ugramaly Sene</th>
<th>Bellik</th>
<th>Statusy</th>
<th>Ýük Çalyşmak</th>
<th>Sazlamalar</th>
</tr>
</tfoot>
@ -205,7 +222,7 @@ function onStart(){
{% put scripts %}
<script src="{{'assets/libs/bootstrap-datepicker/js/bootstrap-datepicker.min.js'|theme}}"></script>
<script src="{{'assets/libs/select2/js/select2.min.js'|theme}}"></script>
<script src="{{'assets/js/pages/form-advanced.init.js'|theme}}"></script>

View File

@ -0,0 +1,153 @@
title = "orders/payment-report"
url = "/orders/payment-report"
layout = "platform_main"
is_hidden = 0
[order]
==
<?php
function onStart(){
}
?>
==
{% put styles %}
<link href="{{'assets/libs/datatables.net-bs4/css/dataTables.bootstrap4.min.css'|theme}}" rel="stylesheet"
type="text/css" />
<link href="{{'assets/libs/datatables.net-buttons-bs4/css/buttons.bootstrap4.min.css'|theme}}" rel="stylesheet"
type="text/css" />
<link href="{{'assets/libs/datatables.net-select-bs4/css/select.bootstrap4.min.css'|theme}}" rel="stylesheet"
type="text/css" />
<link href="{{'assets/libs/select2/css/select2.min.css'|theme}}" rel="stylesheet" type="text/css">
{% endput %}
<div class="container-fluid">
<div class="row">
<div class="col-md-12">
<div class="card">
<div class="card-body">
<form data-request="onReportLogistics" data-request-flash>
<div class="row">
<div class="col">
<div>
<label class="form-label">Seneleri Saýlaň</label>
<div class="input-daterange input-group" id="datepicker6"
data-date-format="d.m.yyyy" data-date-autoclose="true" data-provide="datepicker"
data-date-container='#datepicker6'>
<input type="text" class="form-control" name="start"
placeholder="Başlanýan sene" />
<input type="text" class="form-control" name="end"
placeholder="Gutarýan sene" />
</div>
</div>
</div>
<div class="col">
<label class="form-label">Transport Saýlaň</label>
<select class="form-control select2" name="transport_type">
<option value="0">Saýla</option>
<option value="truck">Tyr</option>
<option value="train">Wagon</option>
</select>
</div>
<div class="col">
<label class="form-label">Ýer ýazyň</label>
<input name="place_now" class="form-control" placeholder="Ýer ýazyň">
</div>
<div class="col">
<label class="form-label">Transport No</label>
<input name="transport_no" class="form-control" placeholder="Transport Nomeri">
</div>
<div class="col">
<label class="form-label">Status</label>
<select class="form-control select2" name="status">
<option value="0">Saýla</option>
<option value="loading">Ýüklenýär</option>
<option value="loaded">Ýüklendi</option>
<option value="complated">Ýerine Ýetirildi</option>
</select>
</div>
<div class="col">
<button type="submit" class="btn btn-primary waves-effect waves-light"
style="margin-top: 30px;width: 100%;">Hasabat</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
<div class="row">
</div>
<div class="row">
<div class="col-md-12">
<div class="card">
<div class="card-body">
<div class="row" id="all_amount">
<div class="col-md-6">
<h3 class="card-title" style="font-size: 22px;color: #1e2038;">Tölegler Boýunça Umumy</h3>
<p class="card-title-desc" style="color: #6c6ff5;">Hasabat</p>
</div>
</div>
<table id="datatable-buttons" class="table table-striped table-bordered dt-responsive nowrap"
style="border-collapse: collapse; border-spacing: 0; width: 100%;" data-page-length='13'>
<thead>
<tr>
<th style="width: 5%;"></th>
<th>Sargyt No</th>
<th>Klent</th>
<th>Ýurdy</th>
<th>Mukdary</th>
<th>Senesi</th>
<th>Bellik</th>
<!-- <th>Настройки</th> -->
</tr>
</thead>
<tbody id="payments_report_datas">
</tbody>
<tfoot>
<tr>
<th style="width: 5%;"></th>
<th>Sargyt No</th>
<th>Klent</th>
<th>Ýurdy</th>
<th>Mukdary</th>
<th>Senesi</th>
<th>Bellik</th>
</tr>
</tfoot>
</table>
</div>
</div>
</div>
</div>
</div>
{% partial 'dataTableJs' %}
{% put scripts %}
<script src="{{'assets/libs/bootstrap-datepicker/js/bootstrap-datepicker.min.js'|theme}}"></script>
<script src="{{'assets/libs/select2/js/select2.min.js'|theme}}"></script>
<script src="{{'assets/js/pages/form-advanced.init.js'|theme}}"></script>
{% endput %}

View File

@ -83,7 +83,7 @@ function onStart(){
<div class="col-md-12">
<div class="card">
<div class="card-body">
<div class="row" id="all_amount">
<div class="row" id="all_amount_report">
<div class="col-md-6">
<h3 class="card-title" style="font-size: 22px;color: #1e2038;">Sargytlar Boýunça Umumy</h3>
<p class="card-title-desc" style="color: #6c6ff5;">Hasabat</p>

View File

@ -69,6 +69,11 @@ function onStart(){
{% set stocks = builderList2.records %}
<div class="row">
<div class="col-12">
<div class="alert alert-info" role="alert">
Direktor bilen Bugalter tassyklamadyk bolsa sklat-da hasaba goşulmaz.
</div>
</div>
<div class="col-12">
<div class="card">
<div class="card-body">
@ -78,13 +83,13 @@ function onStart(){
<p class="card-title-desc" style="color: #6c6ff5;">{{type}}</p>
</div>
<div class="col-md-6" style="text-align: right;">
{% if type == 'inbox' %}
<button onClick="createData();" type="button" class="btn btn-primary waves-effect waves-light"
data-bs-toggle="offcanvas" data-bs-target="#offcanvasBottom"
aria-controls="offcanvasBottom">
<i class="ri-add-line align-middle ms-2" style="font-size: 17px;"></i> Täze Hereket
<i class="ri-add-line align-middle ms-2" style="font-size: 17px;"></i>{% if type == 'inbox' %} Täze Haryt Sal {% else %} Haryt Çykarmak {% endif %}
</button>
{% endif %}
</div>
</div>
<table id="datatable-buttons" class="table table-striped table-bordered dt-responsive nowrap"
@ -97,6 +102,8 @@ function onStart(){
<th>Mukdary (KG)</th>
<th>Senesi</th>
<th>Sklad</th>
<th>Direktor</th>
<th>Bugalter</th>
<th>Bellik</th>
<th>Sazlamalar</th>
</tr>
@ -109,11 +116,13 @@ function onStart(){
<td style="text-align: center;">
<span
class="badge badge-soft-{% if record.type == 'inbox' %}success {% else %}danger {% endif %}"
style="font-size: 14px;">{{record.type}}</span>
style="font-size: 14px;">{% if record.type == 'inbox' %} GIRIŞ {% else %} ÇYKYŞ {% endif %}</span>
</td>
<td style="color: #500101;font-weight: bold;">{{record.amount|number_format}} kg</td>
<td>{{record.created_at|date('d.m.Y')}}</td>
<td>{{record.stock.name}}</td>
<td style="color: {% if record.status_director == 'accept' %}darkgreen {% else %}darkred {% endif %};">{% if record.status_director == 'accept' %} + {% else %} Tassyklanmadyk {% endif %}</td>
<td style="color: {% if record.status_accountant == 'accept' %}darkgreen {% else %}darkred {% endif %};">{% if record.status_accountant == 'accept' %} + {% else %} Tassyklanmadyk {% endif %}</td>
<td>{{record.note}}</td>
<td>
<div style="display: flex;justify-content: center;">
@ -146,6 +155,8 @@ function onStart(){
<th>Mukdary (KG)</th>
<th>Senesi</th>
<th>Sklad</th>
<th>Direktor</th>
<th>Bugalter</th>
<th>Bellik</th>
<th>Sazlamalar</th>
</tr>
@ -199,7 +210,7 @@ function onStart(){
{% endfor %}
</select>
</div>
{% if type == 'inbox' %}
<div class="col-md-4">
<div class="mb-3">
<label for="validationCustom02" class="form-label">Maşyn nomer</label>
@ -215,7 +226,7 @@ function onStart(){
name="driver">
</div>
</div>
{% endif %}
<div class="col-md-4">
<div class="mb-3">
<label for="validationCustom02" class="form-label">Bellik</label>

View File

@ -18,15 +18,15 @@ function onStart() {
if($year){
$this["productions"] = Romanah\Gokbakja\Models\Production::whereMonth('created_at', $this["month"])->whereYear('created_at', $year)->with(['pivot_production'])->get();
$this["month_all_amount"] = Romanah\Gokbakja\Models\Production::whereMonth('created_at', $this["month"])
->whereYear('created_at', $year)
->avg('all_amount');
$this["month_all_amount_calc"] = Romanah\Gokbakja\Models\Production::whereMonth('created_at', $this["month"])->select(DB::raw('MAX(all_amount) - MIN(all_amount) AS amount_subtraction'), DB::raw('MAX(all_amount) AS max_amount'), DB::raw('MIN(all_amount) AS min_amount'), DB::raw('MAX(time) AS max_time'), DB::raw('MIN(time) AS min_time'))
->whereYear('created_at', $year)->first();
}else{
$this["productions"] = Romanah\Gokbakja\Models\Production::whereMonth('created_at', $this["month"])->whereYear('created_at', $currentDate->year)->with(['pivot_production'])->get();
$this["month_all_amount"] = Romanah\Gokbakja\Models\Production::whereMonth('created_at', $this["month"])
->whereYear('created_at', $currentDate->year)
->avg('all_amount');
$this["month_all_amount_calc"] = Romanah\Gokbakja\Models\Production::whereMonth('created_at', $this["month"])->select(DB::raw('MAX(all_amount) - MIN(all_amount) AS amount_subtraction'), DB::raw('MAX(all_amount) AS max_amount'), DB::raw('MIN(all_amount) AS min_amount'), DB::raw('MAX(time) AS max_time'), DB::raw('MIN(time) AS min_time'))
->whereYear('created_at', $currentDate->year)->first();
}
}
?>
@ -57,7 +57,7 @@ function onStart() {
<div class="col-12">
<!-- Left sidebar -->
<div class="email-leftbar card">
<a href="/production" type="button" class="btn btn-danger waves-effect waves-light">
<a href="/excruiters" type="button" class="btn btn-danger waves-effect waves-light">
Täze Hasabat
</a>
<div class="mail-list mt-4">
@ -131,9 +131,7 @@ function onStart() {
</td>
{% for product in report.pivot_production %}
<td>{{product.amount_percentage}} % {% if product.amount != 0 %}<br> <span
style="font-size: 12px;color: darkgray;"> {{product.amount|number_format}}
kg</span> {% endif %}</td>
<td>{{product.amount_percentage}} %</td>
{% endfor %}
<td style="font-weight: bold;color: #0005c5;">{{report.note}}</td>
</tr>
@ -146,11 +144,11 @@ function onStart() {
<td style="text-align: center;">
<span class="badge badge-soft-info"
style="font-size: 14px;">{{month_all_amount|number_format}} kg</span>
style="font-size: 14px;">{{month_all_amount_calc.amount_subtraction|number_format}} kg</span>
</td>
{% for key, product in reportProducts %}
{% partial 'report/product-month-row' prodId=product.id %}
{% partial 'report/product-month-row' prodId=product.id all_amount=month_all_amount_calc.amount_subtraction %}
{% endfor %}
<td style="font-weight: bold;color: #0005c5;"></td>
</tr>
@ -181,4 +179,4 @@ function onStart() {
</div>
{% partial 'dataTableJs' %}
{% partial 'dataTableJs' %}

View File

@ -54,7 +54,7 @@ function onStart() {
<div class="col-12">
<!-- Left sidebar -->
<div class="email-leftbar card">
<a href="/production" type="button" class="btn btn-danger waves-effect waves-light">
<a href="/excruiters" type="button" class="btn btn-danger waves-effect waves-light">
Täze Hasabat
</a>
<div class="mail-list mt-4">
@ -154,4 +154,4 @@ function onStart() {
</div>
{% partial 'dataTableJs' %}
{% partial 'dataTableJs' %}

View File

@ -55,7 +55,7 @@ function onStart(){
<tr>
<th style="width: 5%;"></th>
<th>Aýlar</th>
<th>Ortaça Işlenen</th>
<th>Işlenen çig mal</th>
{% for key, record in reportProducts %}
<th>{{record.name}}</th>
{% endfor %}
@ -66,26 +66,26 @@ function onStart(){
<tbody>
{% partial 'report/row' products=reportProducts title="Ýanwar" no=1 %}
{% partial 'report/row' products=reportProducts title="Fewral" no=2 %}
{% partial 'report/row' products=reportProducts title="Mart" no=3 %}
{% partial 'report/row' products=reportProducts title="Aprel" no=4 %}
{% partial 'report/row' products=reportProducts title="Maý" no=5 %}
{% partial 'report/row' products=reportProducts title="Iýun" no=6 %}
{% partial 'report/row' products=reportProducts title="Iýul" no=7 %}
{% partial 'report/row' products=reportProducts title="Awgust" no=8 %}
{% partial 'report/row' products=reportProducts title="Sentýabr" no=9 %}
{% partial 'report/row' products=reportProducts title="Oktýabr" no=10 %}
{% partial 'report/row' products=reportProducts title="Noýabr" no=11 %}
{% partial 'report/row' products=reportProducts title="Dekabr" no=12 %}
{% partial 'report/row' year=year products=reportProducts title="Ýanwar" no=1 %}
{% partial 'report/row' year=year products=reportProducts title="Fewral" no=2 %}
{% partial 'report/row' year=year products=reportProducts title="Mart" no=3 %}
{% partial 'report/row' year=year products=reportProducts title="Aprel" no=4 %}
{% partial 'report/row' year=year products=reportProducts title="Maý" no=5 %}
{% partial 'report/row' year=year products=reportProducts title="Iýun" no=6 %}
{% partial 'report/row' year=year products=reportProducts title="Iýul" no=7 %}
{% partial 'report/row' year=year products=reportProducts title="Awgust" no=8 %}
{% partial 'report/row' year=year products=reportProducts title="Sentýabr" no=9 %}
{% partial 'report/row' year=year products=reportProducts title="Oktýabr" no=10 %}
{% partial 'report/row' year=year products=reportProducts title="Noýabr" no=11 %}
{% partial 'report/row' year=year products=reportProducts title="Dekabr" no=12 %}
</tbody>
<tfoot>
<tr>
<th style="width: 5%;"></th>
<th>Senesi</th>
<th>Hemmesi</th>
<th>Aýlar</th>
<th>Işlenen çig mal</th>
{% for key, record in reportProducts %}
<th>{{record.name}}</th>
{% endfor %}
@ -103,4 +103,4 @@ function onStart(){
</div>
{% partial 'dataTableJs' %}
{% partial 'dataTableJs' %}

View File

@ -6,15 +6,33 @@ function onStart (){
$year = $this->year;
$prodId = $this->prodId;
$this["amount"] = Romanah\Gokbakja\Models\PivotProduction::where('product_id', $prodId)
$allAmount = $this->all_amount;
$amountCalc = Romanah\Gokbakja\Models\PivotProduction::where('product_id', $prodId)
->whereMonth('created_at', $no)
->whereYear('created_at', $year)
->where('deleted_at', null)
->avg('amount');
->orderBy('id', 'DESC')
->first();
if ($amountCalc != null){
$this["pivot_calc"] = (float) ($amountCalc->amount_percentage / 100) * (float) $allAmount;
$this["percentageCalc"] = (float) $amountCalc->amount_percentage;
}else{
$this["pivot_calc"] = 0;
}
}
?>
==
<td style="text-align: center;">
{{amount|number_format}} kg
{% if pivot_calc > 0 %}
{{pivot_calc|number_format}} kg <br>
<font style="font-size: 12px;color: gray;">
{{percentageCalc|number_format(2)}} %
</font>
{% endif %}
</td>

View File

@ -6,20 +6,39 @@ function onStart (){
$prodId = $this->prodId;
$currentDate = Carbon\Carbon::now()->timezone('UTC +05:00');
$allAmount = $this->all_amount;
if($year){
$this["amount"] = Romanah\Gokbakja\Models\PivotProduction::where('product_id', $prodId)
->whereMonth('created_at', $this["month"])
->whereYear('created_at', $year)
->where('deleted_at', null)
->avg('amount');
$amountCalc = Romanah\Gokbakja\Models\PivotProduction::where('product_id', $prodId)
->whereMonth('created_at', $this["month"])
->whereYear('created_at', $year)
->orderBy('id', 'DESC')
->first();
if ($amountCalc != null){
$this["pivot_calc"] = (float) ($amountCalc->amount_percentage / 100) * (float) $allAmount;
$this["percentageCalc"] = (float) $amountCalc->amount_percentage;
}else{
$this["pivot_calc"] = 0;
}
}else{
$this["amount"] = Romanah\Gokbakja\Models\PivotProduction::where('product_id', $prodId)
->whereMonth('created_at', $this["month"])
->whereYear('created_at', $currentDate->year)
->where('deleted_at', null)
->avg('amount');
$amountCalc = Romanah\Gokbakja\Models\PivotProduction::where('product_id', $prodId)
->whereMonth('created_at', $this["month"])
->whereYear('created_at', $currentDate->year)
->orderBy('id', 'DESC')
->first();
if ($amountCalc != null){
$this["pivot_calc"] = (float) ($amountCalc->amount_percentage / 100) * (float) $allAmount;
$this["percentageCalc"] = (float) $amountCalc->amount_percentage;
}else{
$this["pivot_calc"] = 0;
}
}
@ -28,5 +47,5 @@ function onStart (){
==
<td style="text-align: center;">
<span class="badge badge-soft-info"
style="font-size: 14px;">{{amount|number_format}} kg</span>
style="font-size: 14px;">{{pivot_calc|number_format}} kg</span>
</td>

View File

@ -5,9 +5,9 @@ function onStart (){
$no = $this->no;
$year = $this->year;
$this["all_amount"] = Romanah\Gokbakja\Models\Production::whereMonth('created_at', $no)
->whereYear('created_at', $year)
->avg('all_amount');
$this["all_amount_calc"] = Romanah\Gokbakja\Models\Production::whereMonth('created_at', $no)->select(DB::raw('MAX(all_amount) - MIN(all_amount) AS amount_subtraction'), DB::raw('MAX(all_amount) AS max_amount'), DB::raw('MIN(all_amount) AS min_amount'), DB::raw('MAX(time) AS max_time'), DB::raw('MIN(time) AS min_time'))
->whereYear('created_at', $year)->first();
}
?>
@ -16,9 +16,9 @@ function onStart (){
<tr>
<td style="font-weight: bold;width: 5%;">{{no}}</td>
<td><a href="/all-production-month/{{no}}" style="font-weight: bold;color: #0005c5;"> {{title}} </a></td>
<td><a href="/all-production-month/{{no}}" style="font-weight: bold;"> {{all_amount|number_format}} kg</a></td>
<td><a href="/all-production-month/{{no}}" style="font-weight: bold;"> {{all_amount_calc.amount_subtraction|number_format}} kg</a></td>
{% for key, record in products %}
{% partial "report/month-row" prodId=record.id %}
{% partial "report/month-row" prodId=record.id all_amount=all_amount_calc.amount_subtraction %}
{% endfor %}
<td style="font-weight: bold;color: #0005c5;">{{hours}}</td>
</tr>