mirror of
https://github.com/crater-invoice/crater.git
synced 2025-10-27 11:41:09 -04:00
Merge branch 'custom-field-fixes' into 'master'
This commit is contained in:
@ -47,7 +47,7 @@ class CustomerSalesReportController extends Controller
|
|||||||
foreach ($customers as $customer) {
|
foreach ($customers as $customer) {
|
||||||
$customerTotalAmount = 0;
|
$customerTotalAmount = 0;
|
||||||
foreach ($customer->invoices as $invoice) {
|
foreach ($customer->invoices as $invoice) {
|
||||||
$customerTotalAmount += $invoice->total;
|
$customerTotalAmount += $invoice->base_total;
|
||||||
}
|
}
|
||||||
$customer->totalAmount = $customerTotalAmount;
|
$customer->totalAmount = $customerTotalAmount;
|
||||||
$totalAmount += $customerTotalAmount;
|
$totalAmount += $customerTotalAmount;
|
||||||
|
|||||||
@ -34,7 +34,7 @@ class ProfitLossReportController extends Controller
|
|||||||
$invoicesAmount = Invoice::whereCompanyId($company->id)
|
$invoicesAmount = Invoice::whereCompanyId($company->id)
|
||||||
->applyFilters($request->only(['from_date', 'to_date']))
|
->applyFilters($request->only(['from_date', 'to_date']))
|
||||||
->wherePaidStatus(Invoice::STATUS_PAID)
|
->wherePaidStatus(Invoice::STATUS_PAID)
|
||||||
->sum('total');
|
->sum('base_total');
|
||||||
|
|
||||||
$expenseCategories = Expense::with('category')
|
$expenseCategories = Expense::with('category')
|
||||||
->whereCompanyId($company->id)
|
->whereCompanyId($company->id)
|
||||||
|
|||||||
@ -226,7 +226,7 @@ class Expense extends Model implements HasMedia
|
|||||||
$query->select(
|
$query->select(
|
||||||
DB::raw('
|
DB::raw('
|
||||||
count(*) as expenses_count,
|
count(*) as expenses_count,
|
||||||
sum(amount) as total_amount,
|
sum(base_amount) as total_amount,
|
||||||
expense_category_id')
|
expense_category_id')
|
||||||
)
|
)
|
||||||
->groupBy('expense_category_id');
|
->groupBy('expense_category_id');
|
||||||
|
|||||||
@ -75,7 +75,7 @@ class InvoiceItem extends Model
|
|||||||
public function scopeItemAttributes($query)
|
public function scopeItemAttributes($query)
|
||||||
{
|
{
|
||||||
$query->select(
|
$query->select(
|
||||||
DB::raw('sum(quantity) as total_quantity, sum(total) as total_amount, invoice_items.name')
|
DB::raw('sum(quantity) as total_quantity, sum(base_total) as total_amount, invoice_items.name')
|
||||||
)->groupBy('invoice_items.name');
|
)->groupBy('invoice_items.name');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -68,7 +68,7 @@ class Tax extends Model
|
|||||||
public function scopeTaxAttributes($query)
|
public function scopeTaxAttributes($query)
|
||||||
{
|
{
|
||||||
$query->select(
|
$query->select(
|
||||||
DB::raw('sum(amount) as total_tax_amount, tax_type_id')
|
DB::raw('sum(base_amount) as total_tax_amount, tax_type_id')
|
||||||
)->groupBy('tax_type_id');
|
)->groupBy('tax_type_id');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -64,7 +64,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { computed, ref, watch } from 'vue'
|
import { computed, ref, watch, onMounted } from 'vue'
|
||||||
import { useCustomFieldStore } from '@/scripts/stores/custom-field'
|
import { useCustomFieldStore } from '@/scripts/stores/custom-field'
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
@ -121,6 +121,10 @@ watch(
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
fetchFields()
|
||||||
|
})
|
||||||
|
|
||||||
const value = computed({
|
const value = computed({
|
||||||
get: () => props.modelValue,
|
get: () => props.modelValue,
|
||||||
set: (value) => {
|
set: (value) => {
|
||||||
@ -128,6 +132,10 @@ const value = computed({
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
async function fetchFields() {
|
||||||
|
await customFieldsStore.fetchCustomFields()
|
||||||
|
}
|
||||||
|
|
||||||
async function getFields() {
|
async function getFields() {
|
||||||
fieldList.value = []
|
fieldList.value = []
|
||||||
if (props.fields && props.fields.length > 0) {
|
if (props.fields && props.fields.length > 0) {
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
body {
|
body {
|
||||||
font-family: "DejaVu Sans";
|
font-family: "DejaVu Sans";
|
||||||
}
|
}
|
||||||
|
|
||||||
table {
|
table {
|
||||||
border-collapse: collapse;
|
border-collapse: collapse;
|
||||||
}
|
}
|
||||||
@ -168,7 +168,7 @@
|
|||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<p class="sales-amount">
|
<p class="sales-amount">
|
||||||
{!! format_money_pdf($invoice->total) !!}
|
{!! format_money_pdf($invoice->base_total) !!}
|
||||||
</p>
|
</p>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
Reference in New Issue
Block a user