Skip to content

Instantly share code, notes, and snippets.

View ranafaraz's full-sized avatar
:shipit:

Rana Faraz ranafaraz

:shipit:
View GitHub Profile
@ranafaraz
ranafaraz / Callout to Hit Account Book (Live Server)
Last active February 5, 2021 19:21
This Gist includes callouts of iDempiere that have been implemented for IUB.
// Call out to hit Account Book of IUB
@SuppressWarnings("resource")
public String account_book_api(Properties ctx, int WindowNo, GridTab mTab,
GridField mField, Object value, Object oldValue) throws IOException
{
int c_invoice_id = Integer.parseInt((String) mTab.getValue("c_invoice_id").toString());
String sql = "SELECT " +
"i.c_invoice_id AS Trans_ID," +
@ranafaraz
ranafaraz / Sum of Market Value of Vehicles.sql
Last active March 1, 2021 07:11
Query to get vehicle record from iDempiere
SELECT SUM(mp.market_price) FROM adempiere.market_price mp WHERE mp.ad_client_id = 1000000 AND mp.isactive = 'Y'
--
@ranafaraz
ranafaraz / Bank Acct Details.sql
Created February 16, 2021 20:09
Query to fetch bank account details from iDempiere
SELECT
b.name AS Bank_Name,
bacct.accountno,
-- COUNT(bacct.c_bankaccount_id),
-- SUM(ob.currentbalance)
bacct.bankaccounttype,
@ranafaraz
ranafaraz / Budget Allocation.sql
Created February 18, 2021 06:38
Queries to get Budget Allocation details Major, Minor, Sub, Charge Head Wise.
SELECT
concat(vwc.majorheadvalue, ' - ', vwc.majorhead),
SUM(f.amt) AS Current_Allocation
FROM
gl_fund f
INNER JOIN ad_org o ON (( o.ad_org_id = f.ad_org_id))
INNER JOIN gl_budget b ON (( b.gl_budget_id = f.gl_budget_id ))
INNER JOIN f_vwchart vwc ON (( vwc.c_elementvalue_id = f.c_elementvalue_id ))
@ranafaraz
ranafaraz / CO - AR Invoice.sql
Last active February 22, 2021 15:11
Query to get Paid AR Invoices. This data will be displayed in Account Receivable ---> Received So Far
SELECT
i.documentno AS Invoice_No,
p.documentno AS Payment_No,
concat(bacct.name, ' - ', bacct.accountno) AS Bank_Acct,
concat(ev.value, ' - ', ev.name) AS Charge_Head,
concat(o.value, ' - ', o.name) AS Charge_Org,
i.dateinvoiced,
i.dateacct,
bp.value AS Search_Key,
@ranafaraz
ranafaraz / furniture.sql
Created February 24, 2021 05:48
Queries to get room and furniture details of IUB
SELECT
ep.title AS Equipment_Type,
e.title AS Equipment,
e.picture
FROM
equipments e
INNER JOIN equipements_type ep ON (( ep.id = e.type_id ))
GROUP BY
@ranafaraz
ranafaraz / Budget Allocation and Utilization.sql
Last active February 24, 2021 13:39
Query to fetch Major Head, Minor Head, Sub Head, Budget Head wise ==> Allocation and Utilization against a specified Budget ID.
SELECT
concat(o.value, ' - ', o.name) AS Org,
concat(vwc.majorheadvalue, ' - ', vwc.majorhead) AS MajorHead,
concat(vwc.minorheadvalue, ' - ', vwc.minerhead) AS MinorHead,
concat(vwc.subheadvalue, ' - ', vwc.subhead) AS SubHead,
concat(vwc.value, ' - ', vwc.name) AS BudgetHead,
SUM(f.amt) AS Allocation,
SUM(i.grandtotal) AS Utilization
FROM
SELECT
l.value, -- Unique Identifier of Land
l.name, -- Name of the Land
l.description,
l.location,
(SELECT c.name FROM city c WHERE c.city_id = l.city_id) AS city,
l.longitude,
l.latitude,
l.dimentions,
(SELECT u.name FROM c_uom u WHERE u.c_uom_id = l.c_uom_id) AS uom,
SELECT
bi.value, -- Unique Identifier for Buildings & Infrastructures.
bi.name, -- Name of the Building or Infrastructure.
bi.description,
bi.location,
(SELECT cm.name FROM f_campus cm WHERE cm.f_campus_id = bi.f_campus_id) AS Campus,
(SELECT c.name FROM city c WHERE c.city_id = bi.city_id) AS city,
bi.longitude,
bi.latitude,
bi.dimentions,
@ranafaraz
ranafaraz / Import Legacy Data.php
Created March 7, 2021 13:35
This snippet contains the script to import legacy data of budget utilization into iDempiere.
<?php
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "idempiere";
// Creating connection with MySQL - Local DB
$conn = mysqli_connect($servername, $username, $password, $dbname);
// Check connection
if (!$conn) {