production settings

This commit is contained in:
Shohrat 2023-12-21 01:59:14 +05:00
parent 76670cb664
commit 8a04165387
6 changed files with 73 additions and 44 deletions

View File

@ -88,13 +88,12 @@ class Production extends ComponentBase
if ($start != $currentDateFormat) {
$productions->whereBetween('date', [$start, $end]);
$calc = $productionsCalc->select(DB::raw('MAX(time) AS max_time'), DB::raw('MIN(time) AS min_time'))
->whereBetween('date', [$start, $end])->first();
$diffMinutes = Carbon::parse($calc->max_time)->diffInMinutes($calc->min_time);
$calcTimeDiff = floor($diffMinutes / 60) . ' sagat ' . ($diffMinutes - floor($diffMinutes / 60) * 60) . ' minut';
$calcq = $this->calculateHoursAndMinutes($calc->date, $calc->time);
// $diffMinutes = Carbon::parse($calc->max_time)->diffInMinutes($calc->min_time);
// $calcTimeDiff = floor($diffMinutes / 60) . ' sagat ' . ($diffMinutes - floor($diffMinutes / 60) * 60) . ' minut';
// $calcq = $this->calculateHoursAndMinutes($calc->date, $calc->time);
// dd($calcq);
@ -114,9 +113,26 @@ class Production extends ComponentBase
$pivotIds = PivotProductionModel::whereIn('production_id', $calculationAmountqq)->get()->pluck('id')->toArray();
$calculationAmount = ProductionCalculateModel::whereIn('production_id', $calculationAmountqq)->sum("amount_calc");
$calculationAmount = ProductionCalculateModel::whereIn('prev_pivot_id', $pivotIds)->sum("amount_calc");
$calcHours = $productionsCalcPivot->orderBy('date', 'DESC')->orderBy('time', 'DESC')->get();
$calcHourCount = (count($calcHours) - 1);
$dateStart = $calcHours[0]->date.' '.$calcHours[0]->time;
$dateEnd = $calcHours[$calcHourCount]->date.' '.$calcHours[$calcHourCount]->time;
$carbonInstanceStart = Carbon::parse($dateStart);
$carbonInstanceEnd = Carbon::parse($dateEnd);
$calcHourq = $carbonInstanceEnd->diffInHours($carbonInstanceStart);
$hours = floor($calcHourq); // Get the whole hours
$minutes = ($calcHourq - $hours) * 60;
$calcTimeDiff = $hours.' sagat ';
//dd($pivotIds);
$html_data = '';

View File

@ -16,13 +16,13 @@ function onStart() {
}
if($year){
$this["productions"] = Romanah\Gokbakja\Models\Production::whereMonth('created_at', $this["month"])->whereYear('created_at', $year)->with(['pivot_production'])->get();
$this["productions"] = Romanah\Gokbakja\Models\Production::whereMonth('date', $this["month"])->whereYear('date', $year)->with(['pivot_production'])->get();
$this["month_all_amount_calcq"] = Romanah\Gokbakja\Models\ProductionCalculate::whereMonth('date', $this["month"])->whereYear('date', $year)->sum("amount_calc");
}else{
$this["productions"] = Romanah\Gokbakja\Models\Production::whereMonth('created_at', $this["month"])->whereYear('created_at', $currentDate->year)->with(['pivot_production'])->get();
$this["productions"] = Romanah\Gokbakja\Models\Production::whereMonth('date', $this["month"])->whereYear('date', $currentDate->year)->with(['pivot_production'])->get();
$this["month_all_amount_calcq"] = Romanah\Gokbakja\Models\ProductionCalculate::whereMonth('date', $this["month"])->whereYear('date', $currentDate->year)->sum("amount_calc");
@ -109,9 +109,7 @@ function onStart() {
<th style="width: 5%;"></th>
<th>Senesi</th>
<th>Hemmesi</th>
{% for key, record in reportProducts %}
<th>{{record.code}}</th>
{% endfor %}
<th>Harytlar</th>
<th>Bellik</th>
<!-- <th>Настройки</th> -->
</tr>
@ -122,16 +120,22 @@ function onStart() {
<tr>
<td style="font-weight: bold;width: 5%;">{{key + 1}}</td>
<td><a href="/get-production/{{report.id}}"
style="font-weight: bold;color: #0005c5;">{{report.created_at|date('d.m.Y |
style="font-weight: bold;color: #0005c5;">{{report.date|date('d.m.Y |
H:i')}}</a></td>
<td style="text-align: center;">
<span class="badge badge-soft-success"
style="font-size: 14px;">{{report.all_amount|number_format}} kg</span>
</td>
{% for product in report.pivot_production %}
<td>{{product.amount_percentage}} %</td>
{% endfor %}
<td>
<div class="row">
{% for product in report.pivot_production %}
<div class="col">
<font style="font-weight: bold;"> {{product.product_code}}: </font>
{{product.amount_percentage}} %
</div>
{% endfor %}
</div>
</td>
<td style="font-weight: bold;color: #0005c5;">{{report.note}}</td>
</tr>
{% endfor %}
@ -145,10 +149,14 @@ function onStart() {
<span class="badge badge-soft-info"
style="font-size: 14px;">{{month_all_amount_calcq|number_format}} kg</span>
</td>
{% for key, product in reportProducts %}
{% partial 'report/product-month-row' prodId=product.id all_amount=month_all_amount_calc.amount_subtraction %}
{% endfor %}
<td style="text-align: center;">
<div class="row">
{% for key, product in reportProducts %}
{% partial 'report/product-month-row' product_code=product.code
prodId=product.id all_amount=month_all_amount_calc.amount_subtraction %}
{% endfor %}
</div>
</td>
<td style="font-weight: bold;color: #0005c5;"></td>
</tr>
@ -158,9 +166,7 @@ function onStart() {
<th style="width: 5%;"></th>
<th>Senesi</th>
<th>Hemmesi</th>
{% for key, record in reportProducts %}
<th>{{record.code}}</th>
{% endfor %}
<th>Harytlar</th>
<th>Bellik</th>
</tr>
</tfoot>
@ -178,4 +184,4 @@ function onStart() {
</div>
{% partial 'dataTableJs' %}
{% partial 'dataTableJs' %}

View File

@ -55,9 +55,9 @@ function onStart(){
<th style="width: 5%;"></th>
<th>Aýlar</th>
<th>Işlenen çig mal</th>
{% for key, record in reportProducts %}
<th>{{record.code}}</th>
{% endfor %}
<th>Harytlar</th>
<th>Bellik</th>
<!-- <th>Настройки</th> -->
</tr>
@ -85,9 +85,7 @@ function onStart(){
<th style="width: 5%;"></th>
<th>Aýlar</th>
<th>Işlenen çig mal</th>
{% for key, record in reportProducts %}
<th>{{record.code}}</th>
{% endfor %}
<th>Harytlar</th>
<th>Bellik</th>
</tr>
</tfoot>
@ -102,4 +100,4 @@ function onStart(){
</div>
{% partial 'dataTableJs' %}
{% partial 'dataTableJs' %}

View File

@ -23,9 +23,8 @@ function onStart (){
}
?>
==
<td style="text-align: center;">
{% if pivot_calc > 0 %}
{{pivot_calc|number_format}} kg <br>
{% if pivot_calc > 0 %}
<font style="font-weight: bold;"> {{product_code}}:</font> {{pivot_calc|number_format}} kg <br>
{% endif %}
</td>

View File

@ -26,8 +26,8 @@ function onStart (){
}else{
$amountCalc = Romanah\Gokbakja\Models\ProductionCalculate::where('product_id', $prodId)
->whereMonth('created_at', $this["month"])
->whereYear('created_at', $currentDate->year)
->whereMonth('date', $this["month"])
->whereYear('date', $currentDate->year)
->sum("amount_calc");
@ -43,7 +43,11 @@ function onStart (){
}
?>
==
<td style="text-align: center;">
<span class="badge badge-soft-info"
style="font-size: 14px;">{{pivot_calc|number_format}} kg</span>
</td>
<div class="col">
<span class="badge badge-soft-info" style="font-size: 14px;">
{{product_code}}: {{pivot_calc|number_format}} kg
</span>
</div>

View File

@ -17,8 +17,14 @@ function onStart (){
<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_calc|number_format}} kg</a></td>
{% for key, record in products %}
{% partial "report/month-row" prodId=record.id all_amount=all_amount_calc %}
{% endfor %}
<td style="text-align: center;">
<div class="row">
{% for key, record in products %}
<div class="col">
{% partial "report/month-row" product_code=record.code prodId=record.id all_amount=all_amount_calc %}
</div>
{% endfor %}
</div>
</td>
<td style="font-weight: bold;color: #0005c5;">{{hours}}</td>
</tr>