class MCF_Ledger_Engine { public function get_daily_ledger() { global $wpdb; $table = $wpdb->prefix . 'mcf_ledger'; $rows = $wpdb->get_results(" SELECT order_id, order_date, currency, net_sale, profit, exchange_rate FROM {$table} ORDER BY order_date ASC "); $result = []; foreach ($rows as $row) { if (empty($row->order_date)) { continue; } $date = date('Y-m-d', strtotime($row->order_date)); if (!isset($result[$date])) { $result[$date] = [ 'consolidated' => ['sales'=>0.0,'profit'=>0.0], 'TRY' => ['sales'=>0.0,'profit'=>0.0], 'EUR' => ['sales'=>0.0,'profit'=>0.0], 'orders' => [] ]; } $currency = strtoupper(trim($row->currency)); $net_sale = (float) $row->net_sale; $profit = (float) $row->profit; $exchange_rate = (float) $row->exchange_rate; if ($exchange_rate <= 0) { $exchange_rate = 1; } // Currency raw aggregation if (isset($result[$date][$currency])) { $result[$date][$currency]['sales'] += $net_sale; $result[$date][$currency]['profit'] += $profit; } // TL Consolidation if ($currency === 'EUR') { $sale_tl = $net_sale * $exchange_rate; $profit_tl = $profit * $exchange_rate; } else { $sale_tl = $net_sale; $profit_tl = $profit; } $result[$date]['consolidated']['sales'] += $sale_tl; $result[$date]['consolidated']['profit'] += $profit_tl; $result[$date]['orders'][] = [ 'id' => (int) $row->order_id, 'currency' => $currency, 'profit_tl' => round($profit_tl,2) ]; } return $result; } } Sepet -
Skip to content

  • Anasayfa
  • MağazaExpand
    • Saat KoleksiyonumuzExpand
      • Masa Saatleri
      • Duvar Saatleri
      • Sarkaçlı Saatler
      • Şömine Saatleri
    • Çanta Koleksiyonumuz
    • Mutfak Gereçleri
    • Mücevher Kutusu
    • Yerel ÜrünlerExpand
      • Türkiye Yerel Ürünler
      • Endonezya Yerel Ürünler
      • İran Yerel Ürünler
    • Ahşap Oyuncak
  • Hakkımızda
  • HesabımExpand
    • Giriş
    • Kaydol
    • Siparişlerim
    • Adreslerim
    • Hesap Bilgilerim
    • Çıkış
  • Shopping Cart 2
      • × handmade wooden wall clockVento Wooden Wall Clock 1 × ₺76
      • × Rula Wooden Jewelry BoxRula Ahşap Mücevher Kutusu 1 × ₺1.290

      Ara toplam: ₺1.366 (KDV dahil)

      SepetimÖdeme

“Rula Ahşap Mücevher Kutusu” sepetinize eklendi. Alışverişe devam et

Cart Summary

Ürünü çıkar Küçük resim Ürün Fiyat Miktar Ara Toplam
× handmade wooden wall clock Vento Wooden Wall Clock ₺76
₺76
× Rula Wooden Jewelry Box Rula Ahşap Mücevher Kutusu ₺1.290
₺1.290 (KDV dahil)

Sepet toplamları

Ara Toplam ₺1.366 (KDV dahil)
Toplam ₺1.366
Ödeme sayfasına git

BİLGİ

Hakkımızda

Gizlililk Politikası

whatsapp

WhatsApp’la bize ulaşın

© 2026 By MORGEN

✕
  • Anasayfa
  • Mağaza
    • Saat Koleksiyonumuz
      • Masa Saatleri
      • Duvar Saatleri
      • Sarkaçlı Saatler
      • Şömine Saatleri
    • Çanta Koleksiyonumuz
    • Mutfak Gereçleri
    • Mücevher Kutusu
    • Yerel Ürünler
      • Türkiye Yerel Ürünler
      • Endonezya Yerel Ürünler
      • İran Yerel Ürünler
    • Ahşap Oyuncak
  • Hakkımızda
  • Hesabım
    • Giriş
    • Kaydol
    • Siparişlerim
    • Adreslerim
    • Hesap Bilgilerim
    • Çıkış
Search