Ejemplo n.º 1
0
    def get(self):
        sql = "SELECT * FROM `merek`"

        table_list = connExecute(sql)
        list_data = []
        for data in table_list:
            table_data = tbl(data['merek_id'])
            table_data.add_field_text(data['merek_nama'].title())
            list_data.append(table_data.get())
        return list_data
Ejemplo n.º 2
0
 def get(self, list_data=[]):
     list_data = []
     for data in connExecute(
             "SELECT * FROM `pengguna` as a INNER JOIN `posisi` as b ON a.pengguna_posisi = b.posisi_id"
     ):
         table_data = tbl(data['pengguna_id'])
         table_data.add_field_text(data['pengguna_nama'].title())
         table_data.add_field_text(data['posisi_nama'])
         table_data.add_field_text(data['pengguna_status'])
         list_data.append(table_data.get())
     return list_data
Ejemplo n.º 3
0
    def get(self):
        sql = "SELECT * FROM `master_supplier`"

        table_list = connExecute(sql)
        list_data = []
        for data in table_list:
            table_data = tbl(data['supplier_id'])
            table_data.add_field_text(data['supplier_nama'].title())
            table_data.add_field_text(data['supplier_alamat'].title())
            table_data.add_field_text(data['supplier_provinsi'] + "/" +
                                      data['supplier_kota'])
            table_data.add_field_text(data['supplier_telepon'])
            list_data.append(table_data.get())
        return list_data
Ejemplo n.º 4
0
    def get(self):

        json_data = {}
        data_product_sql = ""
        data_product_sql += "SELECT * FROM `order` as a "
        data_product_sql += "INNER JOIN `pembelian_status` as b ON a.pembelian_status = b.pembelian_status_id "
        data_product_sql += "INNER JOIN `master_supplier` as c ON a.pembelian_supplier_id = c.supplier_id"

        json_data['pembelian_data'] = connExecute(data_product_sql)
        json_data['pembelian_belum_dibayar'] = 0
        json_data['pembelian_jatuh_tempo'] = 0
        json_data['pembelian_selesai'] = 0

        list_data = []
        for pembelian in json_data['pembelian_data']:

            table_data = tbl(pembelian['pembelian_id'])
            table_data.add_field_text(pembelian['supplier_nama'].title())
            table_data.add_field_text(
                pembelian['pembelian_tanggal'] + ' / ' +
                pembelian['pembelian_tanggal_jatuh_tempo'])

            # Pembelian yang belum dibayar
            if pembelian['pembelian_status'] == 'ST202':
                table_data.add_field_badge_danger(
                    pembelian['pembelian_status_nama'].title())
                json_data['pembelian_belum_dibayar'] += pembelian[
                    'pembelian_total']

            # Pembelian yang selesai
            elif pembelian['pembelian_status'] == 'ST200':
                table_data.add_field_badge(
                    pembelian['pembelian_status_nama'].title())
                json_data['pembelian_selesai'] += pembelian['pembelian_total']

            table_data.add_field_price(pembelian['pembelian_total'])
            list_data.append(table_data.get())

        json_data['pembelian_data'] = list_data
        return json_data
Ejemplo n.º 5
0
    def getOrders(self, type):

        json_data = {}
        data_product_sql = ""
        data_product_sql += "SELECT * FROM `order` as a "
        data_product_sql += "INNER JOIN `pembelian_status` as b ON a.pembelian_status = b.pembelian_status_id "

        if type == 100:
            data_product_sql += "INNER JOIN `master_supplier` as c ON a.pembelian_supplier_id = c.supplier_id "

        elif type == 200:
            data_product_sql += "INNER JOIN `master_pelanggan` as c ON a.order_customer_id = c.pelanggan_id "
            data_product_sql += "INNER JOIN `pengguna` as d ON a.order_sales_id = d.pengguna_id "

        data_product_sql += "WHERE `order_type` =  '{}' ".format(type)

        json_data['pembelian_data'] = connExecute(data_product_sql)
        json_data['pembelian_belum_dibayar'] = 0
        json_data['pembelian_jatuh_tempo'] = 0
        json_data['pembelian_selesai'] = 0

        list_data = []
        for pembelian in json_data['pembelian_data']:

            table_data = tbl(pembelian['pembelian_id'])

            if type == 100:
                table_data.add_field_text(pembelian['supplier_nama'].title())

            elif type == 200:
                table_data.add_field_text(pembelian['pengguna_nama'].title())
                table_data.add_field_text(pembelian['pelanggan_nama'].title())

            table_data.add_field_text(
                pembelian['pembelian_tanggal'] + ' / ' +
                pembelian['pembelian_tanggal_jatuh_tempo'])

            # Jatuh Tempo
            if pembelian['pembelian_tanggal_jatuh_tempo'] == str(
                    date.today()) and pembelian['pembelian_status'] != 'ST200':
                table_data.add_field_badge_warning("JATUH TEMPO".title())
                json_data['pembelian_jatuh_tempo'] += pembelian[
                    'pembelian_total']

            # Pembelian yang belum dibayar
            elif pembelian['pembelian_status'] == 'ST202':
                table_data.add_field_badge_danger(
                    pembelian['pembelian_status_nama'].title())
                json_data['pembelian_belum_dibayar'] += pembelian[
                    'pembelian_total']

            # Pembelian yang selesai
            elif pembelian['pembelian_status'] == 'ST200':
                table_data.add_field_badge(
                    pembelian['pembelian_status_nama'].title())
                json_data['pembelian_selesai'] += pembelian['pembelian_total']

            table_data.add_field_price(pembelian['pembelian_total'])
            list_data.append(table_data.get())

        json_data['pembelian_data'] = list_data
        return json_data