/********************************************************************************
///Payscript: SampleSemiMonthlyComputation2.payscript
///Scribe: sweldista.com
///Title: Sample Semi-Monthly Pay Computation
///Summary:
1. Deducts SSS, HDMF and PHIC based on a fixed monthly BasicRate.
1.1 Deducts SSS and HDMF on the 1st half of the month.
1.2 Deducts PHIC on the 2nd half of the month.
2. Computes semi-monthly WTax based on a fixed monthly BasicRate (divided by 2) less deductions.
3. Deducts loans such as SSS loans and Payroll/Cash Advances.
///Environment: Philippines.200901
///WorkingPeriods: Semi-monthly
********************************************************************************/
numeric input var MBasicRate = PreviousPay.MBasicRate; // monthly rate
numeric input var MAllowanceRate = PreviousPay.MAllowanceRate; // monthly rate
{
// rates
numeric output var BasicRate = Round2( MBasicRate/2 ); // semi-monthly rate
numeric output var AllowanceRate = Round2( MAllowanceRate/2 ); // semi-monthly rate
// attendance
numeric input var DaysAbsent = 0.0;
numeric input var HoursLate = 0.0;
numeric input var HoursOvertime = 0.0;
// working days per half of month
var WorkingDays = 12; // Semi-monthly - assumes 12 working days per half
}
{
// basic pay
numeric output var BasicPay = Round2( BasicRate - ( DaysAbsent * BasicRate / WorkingDays ) - ( HoursLate * BasicRate / ( WorkingDays * 8 ) ) );
// overtime
numeric output var OvertimePay = Round2( HoursOvertime * BasicRate / ( WorkingDays * 8 ) );
// other income
numeric input var OtherIncome = 0.0;
// allowance pay
numeric output var AllowancePay = Round2( AllowanceRate - ( DaysAbsent * AllowanceRate / WorkingDays ) - ( HoursLate * AllowanceRate / ( WorkingDays * 8 ) ) );
}
//
numeric output var RegularPay = Round2( BasicPay + AllowancePay );
numeric output var SupplementaryPay = Round2( OvertimePay + OtherIncome );
// sss, phic, hdmf
{
// This sample computes deductions based on the monthly rate of the employee (and not based on the actual pay received).
// This sample does not deduct absences from regularpay for the computation of SSS, PHIC and HDMF
// so that we can deduct SSS and PHIC on the 1st half, and deduct PHIC on the 2nd half.
// (SSS, PHIC and HDMF should be based on one month's pay and not half a month's pay.)
numeric output var RegularPayForMonth = Round2( MBasicRate + MAllowanceRate );
var SubPeriodWithinMonth = 0
{
if( GetMonth( PreviousPayPeriod.AcctgDate ) != GetMonth( PayPeriod.AcctgDate ) )
SubPeriodWithinMonth = 1; // this is the 1st half of the month
if( GetMonth( PayPeriod.AcctgDate ) != GetMonth( NextPayPeriod.AcctgDate ) )
SubPeriodWithinMonth = 2; // this is the 2nd half of the month
}
// Get the SSSBracket based on RegularPayForMonth
vector var SSSBracket = GetSSSTableBracket( RegularPayForMonth );
// MonthPay.SSS and MonthPay.SSSER/MonthPay.SSSEC are the employee and employer contributions for the month (excludes the current period).
// So, the contribution for the period should be derived from the difference of what the contribution of the month should be
// and what has been deducted on the previous periods within the month.
numeric input var SSS = 0
{
if( SubPeriodWithinMonth = 1 )
SSS = SSSBracket.EECont;
}
numeric input var SSSER = 0
{
if( SubPeriodWithinMonth = 1 )
SSSER = SSSBracket.ERCont;
}
numeric input var SSSEC = 0
{
if( SubPeriodWithinMonth = 1 )
SSSEC = SSSBracket.EREC;
}
// Get the PHICBracket based on RegularPayForMonth
vector var PHICBracket = GetPHICTableBracket( RegularPayForMonth );
// MonthPay.PHIC and MonthPay.PHICER are the employee and employer contributions for the month (excludes the current period).
// So, the contribution for the period should be derived from the difference of what the contribution of the month should be
// and what has been deducted on the previous periods within the month.
numeric input var PHIC = 0
{
if( SubPeriodWithinMonth = 2 )
PHIC = PHICBracket.EECont - MonthPay.PHIC;
}
numeric input var PHICER = 0
{
if( SubPeriodWithinMonth = 2 )
PHICER = PHICBracket.ERCont - MonthPay.PHICER;
}
//
numeric input var HDMF = 0
{
if( SubPeriodWithinMonth = 1 )
HDMF = Round2( RegularPayForMonth * 0.01 );
}
numeric input var HDMFER = 0
{
if( SubPeriodWithinMonth = 1 )
{
HDMFER = Round2( RegularPayForMonth * 0.01 );
// check that the total for the month will not exceed 100
if( HDMFER > 100 )
HDMFER = 100;
}
}
}
//
numeric output var ActualNetRegularPay = Round2( RegularPay - SSS - PHIC - HDMF );
// basis for withholding tax
// This sample computes deductions based on the monthly rate of the employee (and not based on the actual pay received).
numeric output var NetRegularPay = Round2( RegularPayForMonth/2 - SSS - PHIC - HDMF );
{
var TaxTable = PayPeriod.PrdType;
// TaxExemption depends on the TaxCode of the Employee
vector var WTaxExemptionBracket = GetWTAXTableExemptionBracket( TaxTable, TaxCode );
var TaxExemption = WTaxExemptionBracket.AmtExempt;
// Compute TaxableRegPay by deducting TaxExemption from NetRegularPay
var TaxableRegPay = NetRegularPay - TaxExemption
{
if( TaxableRegPay < 0 )
TaxableRegPay = 0;
}
// TaxOnBracket and WTaxBracket are based on TaxableRegPay only (without SupplementaryPay)
vector var WTaxBracket = GetWTAXTableTaxBracket( TaxTable, TaxCode, TaxableRegPay );
var TaxOnBracket = WTaxBracket.WTAX;
// TaxOnExcess is based on TaxableRegPay and SupplementaryPay minus the WTaxBracket of the TaxCode
var TaxOnExcess = ( TaxableRegPay - WTaxBracket[ TaxCode ] + SupplementaryPay ) * WTaxBracket.PCTOVER;
}
// WTax is the sum of TaxOnBracket and TaxOnExcess
numeric input var WTax
{
WTax = Round2( TaxOnBracket + TaxOnExcess );
}
//
var LoanTotal = 0.0
{
{
// Beginning balance is derived from the ending balance of the previous pay period
numeric output var L_SSSBB = PreviousPay.L_SSSEB;
// Input any new SSS loan in L_SSSAdj
numeric input var L_SSSAdj = 0.0;
// Loan deduction defaults to the deduction of the previous pay period
numeric input var L_SSS = PreviousPay.L_SSS
{
var EB = L_SSSBB + L_SSSAdj - L_SSS;
// Do not let the Ending Balance be negative
if( EB < 0.0 )
L_SSS = L_SSSBB + L_SSSAdj;
}
// Ending balance is equal to the Beginning Balance plus any new loan minus any Deduction
numeric output var L_SSSEB = L_SSSBB + L_SSSAdj - L_SSS;
}
LoanTotal = LoanTotal + L_SSS;
;
{
// Beginning balance is derived from the ending balance of the previous pay period
numeric output var L_PABB = PreviousPay.L_PAEB;
// Input any new Payroll Advance in L_PAAdj
numeric input var L_PAAdj = 0.0;
// Loan deduction defaults to the deduction of the previous pay period
numeric input var L_PA = PreviousPay.L_PA
{
var EB = L_PABB + L_PAAdj - L_PA;
// Do not let the Ending Balance be negative
if( EB < 0.0 )
L_PA = L_PABB + L_PAAdj;
}
// Ending balance is equal to the Beginning Balance plus any new loan minus any Deduction
numeric output var L_PAEB = L_PABB + L_PAAdj - L_PA;
}
LoanTotal = LoanTotal + L_PA;
;
}
// total of loans
numeric output var LoanDeductions = Round2( LoanTotal );
// net pay
numeric output var NetPay = Round2( ActualNetRegularPay + SupplementaryPay - WTax - LoanDeductions );
return NetPay;