fix report
This commit is contained in:
@@ -20,6 +20,8 @@ use Symfony\Component\HttpKernel\Exception\UnprocessableEntityHttpException;
|
||||
use App\Http\Controllers\Admin\TahesabController;
|
||||
use App\Models\Setting;
|
||||
use App\Models\User;
|
||||
use App\Services\ConfigService;
|
||||
use App\Services\TransactionMetalService;
|
||||
use Hekmatinasser\Verta\Verta;
|
||||
|
||||
|
||||
@@ -178,12 +180,14 @@ class WalletController extends Controller
|
||||
"note" => $data['note'],
|
||||
'sts' => 4,
|
||||
]);
|
||||
$representative = app(ConfigService::class)->mainWalletRepresentativeProduct();
|
||||
new TransactionInterface($wallet_interface, $_inp = [
|
||||
'cash' => 0,
|
||||
'gold' => $data['value'],
|
||||
'expire_at' => now(),
|
||||
"note" => $data['note'],
|
||||
'withdraw_id' => $Withdraw->id,
|
||||
'product_id' => $representative?->id,
|
||||
'active' => true
|
||||
], 7, $deposit, false, $gold_block);
|
||||
|
||||
@@ -199,8 +203,9 @@ class WalletController extends Controller
|
||||
}
|
||||
//send sms to users and customer
|
||||
$status = $data['value'] > 0 ?" شارژ شد ": " کسر شد ";
|
||||
$weightUnit = self::tradeWeightUnit();
|
||||
if($this->Config('charge_notif') == "true"){
|
||||
$message = 'کیف پول کاربر ' . $customer->name . ' به مقدار ' . self::formatSmsGoldWeight($data['value']) . " گرم در تاریخ " . verta()->format('Y/n/j H:i:s') .$status . "بابت" . "\n"
|
||||
$message = 'کیف پول کاربر ' . $customer->name . ' به مقدار ' . self::formatSmsGoldWeight($data['value']) . " {$weightUnit} در تاریخ " . verta()->format('Y/n/j H:i:s') .$status . "بابت" . "\n"
|
||||
. $data['note']
|
||||
. "\n"
|
||||
. $this->Config('name_fa');
|
||||
@@ -209,44 +214,27 @@ class WalletController extends Controller
|
||||
});
|
||||
}
|
||||
|
||||
$message = 'کیف پول شما به اندازه ' . self::formatSmsGoldWeight($data['value']) . " گرم در تاریخ " . verta()->format('Y/n/j H:i:s') . $status . " بابت" . "\n"
|
||||
$message = 'کیف پول شما به اندازه ' . self::formatSmsGoldWeight($data['value']) . " {$weightUnit} در تاریخ " . verta()->format('Y/n/j H:i:s') . $status . " بابت" . "\n"
|
||||
. $data['note']
|
||||
. $this->Config('name_fa');
|
||||
$this->Send($customer->mobile, $message);
|
||||
return response()->json(true);
|
||||
}
|
||||
|
||||
public function index(Request $request)
|
||||
public function index(Request $request, TransactionMetalService $transactionMetalService)
|
||||
{
|
||||
$records = Transaction::with(['customer'])->whereNull('fund_id');
|
||||
$records = Transaction::with(['customer', 'wallet.product:id,metal_id', 'product:id,metal_id'])
|
||||
->whereNull('fund_id');
|
||||
TableEngine::create($records, $request->all())
|
||||
->initSearch(['order_id', 'customer.name'])
|
||||
->select([
|
||||
'*', Transaction::$SELECT_CAJ, Transaction::$SELECT_TYPE_STR, Transaction::$SELECT_SAJ, Transaction::$SELECT_EAJ
|
||||
])->export($records);
|
||||
// foreach ($records['rows'] as &$record) {
|
||||
// if (empty($record->title) or $record->title == "تعریف نشده"){
|
||||
// $record->title = $record->type_str ;
|
||||
// $record->unit = "گرم";
|
||||
// if (isset($record->wallet)) {
|
||||
// $wallet = Wallet::with('product')->where('id',$record->wallet)->first();
|
||||
// if (isset($wallet->product)) {
|
||||
// if ($record->gold > 0){
|
||||
// $record->title = " خرید " ;
|
||||
//
|
||||
// }else{
|
||||
// $record->title = " فروش " ;
|
||||
//
|
||||
// }
|
||||
// $record->title .= $wallet->product->title ;
|
||||
// $record->unit = "عدد";
|
||||
//
|
||||
// }
|
||||
// }
|
||||
// $record->save();
|
||||
// }
|
||||
//
|
||||
// }
|
||||
|
||||
if (isset($records['rows'])) {
|
||||
$records['rows'] = $transactionMetalService->enrichTransactionRows($records['rows']);
|
||||
}
|
||||
$records['catalogMetals'] = $transactionMetalService->catalogMetals();
|
||||
|
||||
return response()->json($records);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user