Skip to content

Instantly share code, notes, and snippets.

View ranafaraz's full-sized avatar

Rana Faraz ranafaraz

View GitHub Profile
@ranafaraz
ranafaraz / Invoice Withholding Callouts
Last active September 21, 2020 07:00
This file contains callouts to calculate withholding taxes per invoice line within iDempiere.
// Call out to calculate GST Base (17% of Income Tax of GST included price)
public String calc_GST_IT (Properties ctx, int WindowNo, GridTab mTab, GridField mField, Object value)
{
// Storing TaxID in a variable.
Integer taxID = (Integer)mTab.getValue("C_Tax_ID");
if (taxID == 1000015 || taxID == 1000016) {
// Resetting values to zero
<!DOCTYPE html>
<html>
<head>
<title>University Markers on Open Source Maps</title>
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.7.1/dist/leaflet.css"
integrity="sha512-xodZBNTC5n17Xt2atTPuE1HxjVMSvLVW9ocqUKLsCC5CXdbqCmblAshOMAS6/keqq/sMZMZ19scR4PsZChSR7A=="
crossorigin=""/>
<!-- Make sure you put this AFTER Leaflet's CSS -->
@ranafaraz
ranafaraz / UUID.php
Created December 29, 2020 05:47 — forked from dahnielson/UUID.php
Pure PHP UUID generator
<?php
/**
* UUID class
*
* The following class generates VALID RFC 4122 COMPLIANT
* Universally Unique IDentifiers (UUID) version 3, 4 and 5.
*
* UUIDs generated validates using OSSP UUID Tool, and output
* for named-based UUIDs are exactly the same. This is a pure
* PHP implementation.
@ranafaraz
ranafaraz / Create BPartner on iDempiere using SOAP
Last active December 29, 2020 09:17
This GIST contains SOAP Web Service of iDempiere to create Business Partner and its location.
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:_0="http://idempiere.org/ADInterface/1_0">
<soapenv:Header/>
<soapenv:Body>
<_0:createData>
<_0:ModelCRUDRequest>
<_0:ModelCRUD>
<_0:serviceType>create_bpartner</_0:serviceType>
<_0:TableName>c_bpartner</_0:TableName>
<_0:DataRow>
$wsdl = '
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:_0="http://idempiere.org/ADInterface/1_0">
<soapenv:Header/>
<soapenv:Body>
<_0:createData>
<_0:ModelCRUDRequest>
<_0:ModelCRUD>
<_0:serviceType>invoice</_0:serviceType>
<_0:TableName>C_Invoice</_0:TableName>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:_0="http://idempiere.org/ADInterface/1_0">
<soapenv:Header/>
<soapenv:Body>
<_0:setDocAction>
<_0:ModelSetDocActionRequest>
<_0:ModelSetDocAction>
<_0:serviceType>complete_invoice</_0:serviceType>
<_0:tableName>C_Invoice</_0:tableName>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:_0="http://idempiere.org/ADInterface/1_0">
<soapenv:Header/>
<soapenv:Body>
<_0:createData>
<_0:ModelCRUDRequest>
<_0:ModelCRUD>
<_0:serviceType>create_payment</_0:serviceType>
<_0:TableName>C_Payment</_0:TableName>
<_0:DataRow>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:_0="http://idempiere.org/ADInterface/1_0">
<soapenv:Header/>
<soapenv:Body>
<_0:setDocAction>
<_0:ModelSetDocActionRequest>
<_0:ModelSetDocAction>
<_0:serviceType>complete_payment</_0:serviceType>
<_0:tableName>C_Payment</_0:tableName>
@ranafaraz
ranafaraz / BudgetDetails(Callout Query).sql
Last active January 30, 2021 17:51
This query is used to fetch total and utilized budget against a specific charge head and financial year, using a callout applied on C_Charge_ID. Note: InvoiceLine is being used as Ledger and budget is available in GL Fund. #iDempiere
-- Static values were replaced by dynamic Form values in the Callout.
SELECT
f.amt AS Total_Budget,
(
SELECT SUM
( linetotalamt )
FROM
( adempiere.c_invoiceline ledger INNER JOIN adempiere.c_invoice lgi ON ( ( ledger.c_invoice_id = lgi.c_invoice_id ) ) )
WHERE
@ranafaraz
ranafaraz / PaymentVoucherQuery.sql
Last active February 3, 2021 05:26
This query is used to print the details in the payment voucher attached with Payment Window of iDempiere.
-- This query is deprecated as withholding taxes has been moved to Invoice (Vendor) window.
SELECT
( CASE WHEN ( P.c_doctype_id = ( 1000012 ) :: NUMERIC ) THEN 'Bank Payment Voucher' :: TEXT ELSE'Cash Receiving Voucher' :: TEXT END ) :: CHARACTER VARYING ( 70 ) AS print_title,
-- Client
( SELECT cl.NAME FROM adempiere.ad_client cl WHERE cl.ad_client_id = i.ad_client_id ) AS Client,
-- Organization
concat ( org.VALUE, ' - ', org.NAME ) AS Org,
-- BPartner Variables
concat ( bp.NAME, ' (ID: ', bp.VALUE, ') ', bp.description ) AS BPartner,
-- Invoice Variables