Hi, I have 3 feilds in my invoice processing Table.

  1. Submet
  2. Return
  3. Resubmitted

Now I am using this query

SELECT  `SRNo` ,  `VenName` ,  `Submet` , TO_DAYS( NOW( ) ) - TO_DAYS( `Submet` ) AS Days
FROM  `invmain` 
WHERE  `Status` =  'SENT TO PAYABLE'
AND  `Submet` !=  '0000-00-00'
ORDER BY Days DESC

But this query give me result only on base of Submet.
But I need result on Resubmitted also when its resubmitted.
I need below mentioned Results...

if Submet date is 2011-03-22 this will show days pending 2.
But if Submet is 2011-03-10, but it will return and then resubmitted on 2011-03-20 then it give result 14 instead of 4 days

I use this query but its not working

SELECT  `SRNo` ,  `Submet` ,  CASE days
WHEN `Submet` !=  '0000-00-00' THEN TO_DAYS( NOW( ) ) - TO_DAYS( `Submet` ) as Days
ELSE  TO_DAYS( NOW( ) ) - TO_DAYS( `Resubmitted` ) as Days
END
FROM  `invmain` 
WHERE  `Status` =  'SENT TO PAYABLE'
AND  `Submet` !=  '0000-00-00'

but its giving error

post your table structure, sample data and expected result from that data, do no post query.

Procedure is to submet Payments in Payable department, and check how many days Payable take to give payments.
3 fields are important for this issue.

  1. SubPayDate // when payment submetted to paybale
  2. PayRetDate // When Payment return from paybale to our department
  3. ResubPayDat // aganin resubmitted to payable

If payment submet to finance and not return then its straight forward to calculate days by getting the difference from current day.
But in case payment submet and return and then again resubmitted then i need to check the delay from the resubpaydat for delay , and ignore subpaydate.

Table structure and sample data

--
-- Table structure for table `invmain`
--

CREATE TABLE IF NOT EXISTS `invmain` (
  `SRNo` int(6) NOT NULL AUTO_INCREMENT,
  `PONos` varchar(10) NOT NULL,
  `CRNo` varchar(10) NOT NULL,
  `ContractRefNo` varchar(60) NOT NULL,
  `Region` varchar(5) NOT NULL,
  `VenName` varchar(100) NOT NULL,
  `InvoiceNature` varchar(200) NOT NULL,
  `InvNo` varchar(100) NOT NULL,
  `InvDate` date NOT NULL,
  `InvMonth` varchar(40) NOT NULL,
  `InvAmount` double NOT NULL,
  `RecONMDate` date NOT NULL,
  `SentRegVerDate` date NOT NULL,
  `RegVerRecDate` date NOT NULL,
  `SubPayDate` date NOT NULL,
  `PayRetDate` date NOT NULL,
  `ResubPayDate` date NOT NULL,
  `RealPAyDAte` date NOT NULL,
  `Remarks` varchar(250) NOT NULL,
  `Status` varchar(30) NOT NULL,
  `User` varchar(50) NOT NULL,
  `Time` time NOT NULL,
  `Date` date NOT NULL,
  `CurrencyA` varchar(3) NOT NULL,
  PRIMARY KEY (`SRNo`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=1798 ;

--
-- Dumping data for table `invmain`
--

INSERT INTO `invmain` (`SRNo`, `PONos`, `CRNo`, `ContractRefNo`, `Region`, `VenName`, `InvoiceNature`, `InvNo`, `InvDate`, `InvMonth`, `InvAmount`, `RecONMDate`, `SentRegVerDate`, `RegVerRecDate`, `SubPayDate`, `PayRetDate`, `ResubPayDate`, `RealPAyDAte`, `Remarks`, `Status`, `User`, `Time`, `Date`, `CurrencyA`) VALUES
(511, 'NILL', '', 'Nil', 'North', 'ALCATEL LUCENT', 'E.BILLS PAYMENT ON BEHALF OF CMPAK', '6', '2010-03-22', 'MAR/APR-10', 355222, '2010-04-26', '2010-04-27', '2010-08-17', '2010-09-14', '0000-00-00', '0000-00-00', '0000-00-00', '', 'SENT TO PAYABLE', '', '00:00:00', '0000-00-00', 'PKR'),
(614, 'NILL', '', 'Nil', 'North', 'ALCATEL LUCENT', 'E.BILLS PAYMENT ON BEHALF OF CMPAK / 150 sites', '4', '2010-05-10', 'Jan-08 to Oct-10', 3600448, '2010-05-25', '2010-05-26', '2010-08-17', '2010-09-14', '0000-00-00', '0000-00-00', '0000-00-00', '', 'SENT TO PAYABLE', '', '00:00:00', '0000-00-00', 'PKR'),
(615, 'NILL', '', 'Nil', 'North', 'ALCATEL LUCENT', 'E.BILLS PAYMENT ON BEHALF OF CMPAK/ 28 sites', '8', '2010-05-10', 'Feb-08 to aug-09', 577266, '2010-05-25', '2010-05-26', '2010-08-17', '2010-09-14', '0000-00-00', '0000-00-00', '0000-00-00', '', 'SENT TO PAYABLE', '', '00:00:00', '0000-00-00', 'PKR'),
(617, 'NILL', '', 'Nil', 'North', 'ALCATEL LUCENT', 'E.BILLS PAYMENT ON BEHALF OF CMPAK/ 12 sites', '7', '2010-05-10', 'February-10', 254521, '2010-05-25', '2010-05-26', '2010-08-17', '2010-09-14', '0000-00-00', '0000-00-00', '0000-00-00', '', 'SENT TO PAYABLE', '', '00:00:00', '0000-00-00', 'PKR'),
(769, 'NILL', '', 'Nil', 'North', 'ALCATEL LUCENT', 'E.BILLS PAYMENT ON BEHALF OF CMPAK/ 33 sites', '11', '2010-05-28', 'January-10', 182327, '2010-06-30', '2010-07-01', '2010-08-17', '2010-09-14', '0000-00-00', '0000-00-00', '0000-00-00', '', 'SENT TO PAYABLE', '', '00:00:00', '0000-00-00', 'PKR'),
(770, 'NILL', '', 'Nil', 'North', 'ALCATEL LUCENT', 'E.BILLS PAYMENT ON BEHALF OF CMPAK/ 13 sites', '10', '2010-05-28', 'October-08', 186611, '2010-06-30', '2010-07-01', '2010-08-17', '2010-09-14', '0000-00-00', '0000-00-00', '0000-00-00', '', 'SENT TO PAYABLE', '', '00:00:00', '0000-00-00', 'PKR'),
(783, 'PPO-033898', '', 'O&M-South-PL-MS-24', 'HQ', 'PEOPLE LOGIC', 'CONSUMABLE ITEMS OF JUN-10', '12', '2010-06-30', 'June-10', 1469815, '2010-07-08', '2010-07-08', '2011-02-28', '2011-03-07', '0000-00-00', '0000-00-00', '0000-00-00', '', 'SENT TO PAYABLE', 'imran.ishaq', '11:56:11', '2011-03-08', 'PKR'),
(903, 'PPO-036022', '', 'O&M-South-Union-DGM-09', 'South', 'UNION POWER', 'DG MAINTINANCE SPECIAL SERVICE PARTS RENTAL SERVICE', '62/63/64/NIL', '2010-07-31', 'July-10', 1718726, '2010-08-06', '2010-08-11', '2011-01-27', '0000-00-00', '0000-00-00', '2011-02-15', '0000-00-00', '', 'SENT TO PAYABLE', 'sonia.tipu', '12:00:13', '2011-02-15', 'PKR'),
(968, 'NILL', '', 'Nil', 'North', 'ALCATEL LUCENT', 'E.BILLS PAYMENT ON BEHALF OF CMPAK/ 28 sites', '12', '2010-06-25', 'NOV-09 TO MAY-10', 249792, '2010-08-27', '2010-08-27', '2010-10-05', '2010-10-11', '0000-00-00', '0000-00-00', '0000-00-00', '', 'SENT TO PAYABLE', '', '00:00:00', '0000-00-00', 'PKR'),
(1007, 'NILL', '', 'Nil', 'HQ', 'ALCATEL LUCENT SHANGHAI BELL CO. LTD', 'O & M EQUIPMENTS PORTABLE PC 9 QTY IN NORTH WH', '070057-0024', '2009-04-20', 'NIL', 9166, '2010-09-09', '2010-09-09', '2010-09-14', '2010-09-15', '0000-00-00', '0000-00-00', '0000-00-00', 'PAYMENT HOLD BY HQ DUE TO NOT FULL DELIVERY', 'SENT TO PAYABLE', '', '00:00:00', '0000-00-00', 'USD'),
(1015, 'PPO-034368', '', 'O&M-South-PL-MS-24', 'HQ', 'PEOPLE LOGIC', 'CONSUMABLE ITEMS OF JUL-10', '14', '2010-09-08', 'JUL110', 929070, '2010-09-14', '2010-11-23', '2011-02-28', '2011-03-07', '0000-00-00', '0000-00-00', '0000-00-00', '', 'SENT TO PAYABLE', 'imran.ishaq', '11:56:30', '2011-03-08', 'PKR'),
(1054, 'PPO-034368', '', 'O&M-South-PL-MS-24', 'HQ', 'PEOPLE LOGIC', 'CONSUMABLE ITEMS', '15', '2010-09-16', 'August-10', 382682, '2010-09-21', '2010-11-23', '2011-02-28', '2011-03-07', '0000-00-00', '0000-00-00', '0000-00-00', '', 'SENT TO PAYABLE', 'imran.ishaq', '11:56:46', '2011-03-08', 'PKR'),
(1096, 'PPO-034368', '', 'O&M-South-PL-MS-24', 'HQ', 'PEOPLE LOGIC', 'CONSUMABLE ITEMS OF SEP-10', '16', '2010-10-05', 'September-10', 787205, '2010-10-06', '2010-11-23', '2011-02-28', '2011-03-07', '0000-00-00', '0000-00-00', '0000-00-00', '', 'SENT TO PAYABLE', 'imran.ishaq', '11:57:10', '2011-03-08', 'PKR'),
(1100, 'PPO-034783', '', 'Nil', 'HQ', 'ALCATEL LUCENT SHANGHAI BELL CO. LTD', 'SYSTEM SUPPORT SERVICES 15 % AT THE END OF FIRST QUARTER POST WARANTY MAINTINANCE SERVICES', '100200-002', '2010-09-15', 'JUN/JUL/AUG-10', 115652.1, '2010-10-05', '2010-10-05', '2011-03-02', '2011-03-10', '0000-00-00', '0000-00-00', '0000-00-00', '$', 'SENT TO PAYABLE', 'imran.ishaq', '11:39:29', '2011-03-14', 'USD'),
(1142, 'PPO-032321', '', 'O&M-C-3-Celeros-DGM-15', 'C-3', 'CELEROS NETWORKS', 'DG PM/CM SERVICE', 'NIL', '2010-09-21', 'August-10', 326000, '2010-10-08', '2010-10-13', '2011-01-31', '2011-02-09', '0000-00-00', '0000-00-00', '0000-00-00', '', 'SENT TO PAYABLE', 'sonia.tipu', '12:32:06', '2011-03-02', 'PKR'),
(1162, 'PPO-032321', '', 'O&M-C-3-Celeros-DGM-15', 'C-3', 'CELEROS NETWORKS', 'DG PM/CM SERVICE', '10', '2010-10-19', 'September-10', 300000, '2010-10-20', '2010-10-20', '2011-01-31', '2011-02-09', '0000-00-00', '0000-00-00', '0000-00-00', '', 'SENT TO PAYABLE', 'sonia.tipu', '12:31:21', '2011-03-02', 'PKR'),
(1203, 'PPO-032321', '', 'O&M-C-3-Celeros-DGM-15', 'C-3', 'CELEROS NETWORKS', 'DG PARTS &SPECIAL SERVICES', '8', '2010-10-26', 'July-10', 401430, '2010-11-01', '2010-11-01', '2010-12-16', '2011-02-09', '0000-00-00', '0000-00-00', '0000-00-00', 'Claimed Signed on 13-jan-10', 'SENT TO PAYABLE', 'sonia.tipu', '12:46:33', '2011-03-02', 'PKR'),
(1240, 'PPO-032321', '', 'O&M-C-3-Celeros-DGM-15', 'C-3', 'CELEROS NETWORKS', 'DG PARTS &SPECIAL SERVICES', '9', '2010-11-01', 'August-10', 521272, '2010-11-05', '2010-11-08', '2011-01-16', '2011-02-17', '0000-00-00', '0000-00-00', '0000-00-00', 'Claimed Signed on 13-jan-10', 'SENT TO PAYABLE', 'sonia.tipu', '10:57:05', '2011-02-18', 'PKR'),
(1266, 'PPO-034781', '', '', 'HQ', 'ALCATEL LUCENT', 'Post Warranty Maintenance  Service(Q1) 15%', 'Maintenence-02', '2010-10-05', 'October-2010', 2467518, '2010-11-10', '2010-11-23', '2011-03-02', '2011-03-07', '0000-00-00', '0000-00-00', '0000-00-00', '', 'SENT TO PAYABLE', 'imran.ishaq', '11:53:30', '2011-03-08', 'PKR'),
(1277, 'PPO-032321', '', '', 'C-3', 'CELEROS NETWORKS', 'DG SERVICES', '12', '2010-11-15', 'October-2010', 354000, '2010-11-25', '2010-11-25', '2011-01-31', '0000-00-00', '0000-00-00', '0000-00-00', '2011-02-09', '', 'SENT TO PAYABLE', 'sonia.tipu', '09:21:59', '2011-02-10', 'PKR'),
(1287, 'PPO-032363', '', '', 'North', 'ALCATEL LUCENT', 'SUPPLIES & SPECIAL SERVICES', '84', '2010-11-03', 'June-2010', 8712604, '2010-11-25', '2010-11-26', '0000-00-00', '2011-01-20', '0000-00-00', '0000-00-00', '0000-00-00', 'ASIM SAEED: Q2 PAYMENT', 'SENT TO PAYABLE', 'sonia.tipu', '17:14:25', '2011-01-20', 'PKR'),
(1288, 'PPO-032363', '', '', 'North', 'ALCATEL LUCENT', 'SUPPLIES & SPECIAL SERVICES', '85', '2010-11-03', 'September-2010', 5771293, '2010-11-25', '2010-11-26', '2011-03-01', '2011-03-10', '0000-00-00', '0000-00-00', '0000-00-00', '', 'SENT TO PAYABLE', 'imran.ishaq', '11:01:29', '2011-03-10', 'PKR'),
(1369, 'PPO-031941', '', '', 'South', 'UNION POWER', 'Special services & parts Dec-09', '048 &049', '2010-12-02', 'December-2010', 30163, '2010-12-07', '2010-12-14', '2011-03-01', '2011-03-10', '2011-03-22', '2011-03-22', '0000-00-00', 'DELAY REASON Entered on 22nd', 'SENT TO PAYABLE', 'sonia.tipu', '12:29:48', '2011-03-22', 'PKR'),
(1301, 'NILL', '', '', 'HQ', 'ALCATEL LUCENT SHANGHAI BELL CO. LTD', 'TRAINING NETWORK M/W PALINING', '070057-0033', '2009-11-04', 'October-2010', 53375, '2010-11-28', '2010-11-29', '2010-12-30', '2010-12-07', '0000-00-00', '0000-00-00', '0000-00-00', '', 'SENT TO PAYABLE', 'imran.ishaq', '17:02:59', '2010-12-07', 'USD'),
(1326, 'PPO-035714', '', '', 'C-1', 'BAAS & CO. SERVICE EXPERT', '25 KVA TRANSFORMER REPAIRED AT C-6736', '11', '2010-11-25', 'November-2010', 25000, '2010-12-01', '2010-12-02', '2011-02-24', '2011-03-07', '0000-00-00', '0000-00-00', '0000-00-00', 'vendor dispatchin invoice and PO- Completion received', 'SENT TO PAYABLE', 'imran.ishaq', '11:49:27', '2011-03-08', 'PKR'),
(1387, 'PPO-032429', '', '', 'North', 'UNION POWER', 'DG MAINTENANCE, SPECIAL SERVICES AND PARTS', '50,51C,53D,54A,55C,56C,57C,58D,65C', '2010-12-08', 'January-2010', 279718.05, '2010-12-13', '2010-12-14', '2011-03-01', '2011-03-07', '0000-00-00', '0000-00-00', '0000-00-00', '', 'SENT TO PAYABLE', 'imran.ishaq', '11:49:02', '2011-03-08', 'PKR'),
(1379, 'PPO-032321', '', '', 'C-3', 'CELEROS NETWORKS', 'DG MAINTINANCE SERVICES', '013', '2010-12-07', 'November-2010', 360000, '2010-12-10', '2010-12-10', '2011-01-31', '0000-00-00', '0000-00-00', '0000-00-00', '2011-02-09', 'imran ishaq', 'SENT TO PAYABLE', 'sonia.tipu', '09:22:35', '2011-02-10', 'PKR'),
(1380, 'PPO-036471', '', '', 'C-3', 'CELEROS NETWORKS', 'DG MAINTINANCE SERVICES', '010', '2010-11-12', 'September-2010', 439129, '2010-12-10', '2010-12-10', '2011-01-31', '2011-02-17', '0000-00-00', '0000-00-00', '0000-00-00', '', 'SENT TO PAYABLE', 'sonia.tipu', '16:20:08', '2011-02-17', 'PKR'),
(1381, 'PPO-036471', '', '', 'C-3', 'CELEROS NETWORKS', 'DG MAINTINANCE SERVICES', '010-Commercial invoice', '2010-11-12', 'September-2010', 109492, '2010-12-10', '2010-12-10', '2011-01-31', '2011-02-17', '0000-00-00', '0000-00-00', '0000-00-00', 'Special Services- 14-Feb-11', 'SENT TO PAYABLE', 'sonia.tipu', '16:20:56', '2011-02-17', 'PKR'),
(1389, 'Nill', '', '', 'North', 'ALCATEL LUCENT', 'System supprt', 'CN-03', '2010-11-01', 'June-2010', 3992, '2010-12-01', '0000-00-00', '0000-00-00', '2010-12-20', '0000-00-00', '0000-00-00', '0000-00-00', 'first quarter-Jan to Jun', 'SENT TO PAYABLE', 'imran.ishaq', '09:44:18', '2010-12-20', 'PKR'),
(1403, 'PPO-035117', '', '', 'HQ', 'SANA SERVICES', 'PCM', '01/30', '2010-12-01', 'November-2010', 584305, '2010-12-21', '2010-12-24', '2011-02-07', '0000-00-00', '0000-00-00', '2011-02-15', '0000-00-00', '', 'SENT TO PAYABLE', 'sonia.tipu', '11:59:15', '2011-02-15', 'PKR'),
(1409, 'PPO-036259', '', '', 'North', 'ZTE Pakistan (Pvt) Ltd', 'Claim-O&M services 2nd amendment ', '20093726', '2010-12-10', 'November-2010', 314018, '2010-12-21', '2011-02-23', '2011-03-02', '2011-03-07', '0000-00-00', '0000-00-00', '0000-00-00', '', 'SENT TO PAYABLE', 'imran.ishaq', '11:52:49', '2011-03-08', 'USD'),
(1437, 'PPO-034044', '', '', 'C-1', 'PRIME TELE POWER SOLUTION', '25 kva txn repair 5497', '5272', '2010-12-01', 'October-2010', 30000, '2010-12-09', '2010-12-27', '2011-02-28', '2011-03-07', '0000-00-00', '0000-00-00', '0000-00-00', '', 'SENT TO PAYABLE', 'imran.ishaq', '11:48:44', '2011-03-08', 'PKR'),
(1439, 'PPO-035080', '', '', 'C-1', 'PRIME TELE POWER SOLUTION', '25 kva txn repair 5223', '5281', '2010-12-01', 'October-2010', 30000, '2010-12-09', '2010-12-27', '2011-02-28', '2011-03-07', '0000-00-00', '0000-00-00', '0000-00-00', '', 'SENT TO PAYABLE', 'imran.ishaq', '11:48:27', '2011-03-08', 'PKR'),
(1440, 'PPO-035585', '', '', 'South', 'PRIME TELE POWER SOLUTION', '3 phase energy meter replacement at 0969, 1368, 1115, 1564 and 1027', '5285', '2010-12-01', 'October-2010', 70000, '2010-12-09', '2010-12-27', '2011-02-28', '2011-03-04', '0000-00-00', '0000-00-00', '0000-00-00', '', 'SENT TO PAYABLE', 'imran.ishaq', '09:20:55', '2011-03-09', 'PKR'),
(1441, 'PPO-034755', '', '', 'North', 'PRIME TELE POWER SOLUTION', '3 phase energy meter replacement at ptcl site', '5289', '2010-12-01', 'October-2010', 14000, '2010-12-09', '2010-12-27', '0000-00-00', '0000-00-00', '0000-00-00', '2011-02-15', '0000-00-00', '', 'SENT TO PAYABLE', 'sonia.tipu', '12:34:30', '2011-02-15', 'PKR'),
(1444, 'PPO-033632', '', '', 'North', 'HUAWEI TECHNOLOGIES PAKISTAN', 'Managed services completion Nov-10', 'HW1001738', '2010-12-23', 'November-2010', 46239, '2010-12-27', '2010-12-28', '0000-00-00', '2011-02-03', '0000-00-00', '0000-00-00', '0000-00-00', '', 'SENT TO PAYABLE', 'sonia.tipu', '11:32:17', '2011-02-18', 'PKR'),
(1446, 'PPO-035868', '', '', 'North', 'MAB FIRE PROTECTION (PVT.) LTD', 'Fire extinguisher ctrl panel signa xt with fire alarm bell with installation', 'S-182-1210', '2010-12-14', 'DEC-2010', 58500, '2010-12-27', '2010-12-28', '2011-02-10', '0000-00-00', '0000-00-00', '2011-02-15', '0000-00-00', '', 'SENT TO PAYABLE', 'sonia.tipu', '11:58:37', '2011-02-15', 'PKR'),
(1604, 'PPO-035532', '', '', 'South', 'NEW SHAFIQ BROTHERS & CO', 'hi-ace vehicles refueling and OT nawabshah', '05-', '2011-01-21', 'December-2010', 74960, '2011-02-07', '0000-00-00', '0000-00-00', '2011-02-15', '0000-00-00', '0000-00-00', '0000-00-00', '', 'SENT TO PAYABLE', 'sonia.tipu', '09:32:37', '2011-03-22', 'PKR'),
(1502, 'PO-035539', '', '', 'South', 'FLOWTECH RAWALPINDI', 'Spare Parts & PWR Eqp', '99', '2010-12-22', 'December-2010', 218643, '2011-01-14', '2011-01-14', '0000-00-00', '2011-03-15', '0000-00-00', '2011-02-15', '0000-00-00', '', 'SENT TO PAYABLE', 'imran.ishaq', '15:30:12', '2011-03-18', 'PKR'),
(1603, 'PPO-036574', '', '', 'North', 'NANCY ENGG. & SERVICES', 'AC Maintenanace North', '0702/01/11', '2011-02-07', 'January-2011', 400400, '2011-02-07', '2011-02-07', '2011-02-18', '2011-02-25', '0000-00-00', '0000-00-00', '0000-00-00', '', 'SENT TO PAYABLE', 'sonia.tipu', '18:03:22', '2011-02-25', 'PKR'),
(1523, 'PPO-035505', '', '', 'North', 'DAMCON ENGINEERING SOLUTION', 'Sale tax-Spare Pa', '28', '2011-01-03', 'December-2010', 686506, '2011-01-19', '2011-01-19', '2011-01-27', '2011-02-07', '0000-00-00', '0000-00-00', '0000-00-00', '', 'SENT TO PAYABLE', 'sonia.tipu', '09:38:22', '2011-02-08', 'PKR'),
(1524, 'PPO-036120', '', '', 'South', 'DAMCON ENGINEERING SOLUTION', 'Supply and installation of Meterx1, Refueling motorx2,stand of fuel tankx2', '107', '2011-01-18', 'December-2010', 42500, '2011-01-19', '2011-01-19', '2011-02-22', '2011-02-25', '0000-00-00', '0000-00-00', '0000-00-00', '', 'SENT TO PAYABLE', 'sonia.tipu', '17:50:52', '2011-02-25', 'PKR'),
(1529, 'PPO-035233', '', '', 'South', 'SYED COMMUNICATION AND ENGG. SERVICE', 'CW', '01/02/10-10', '2010-10-04', 'December-2010', 116000, '2011-01-20', '2011-01-20', '2011-01-20', '2011-01-26', '0000-00-00', '0000-00-00', '0000-00-00', '', 'SENT TO PAYABLE', 'imran.ishaq', '16:17:50', '2011-01-28', 'PKR'),
(1535, 'PPO-035505', '', '', 'North', 'DAMCON ENGINEERING SOLUTION', 'Special Services-Dec', '105', '2011-01-03', 'December-2010', 19089, '2011-01-19', '2011-01-19', '2011-01-27', '2011-02-07', '0000-00-00', '0000-00-00', '0000-00-00', '', 'SENT TO PAYABLE', 'sonia.tipu', '09:38:47', '2011-02-08', 'PKR'),
(1536, 'PPO-035505', '', '', 'North', 'DAMCON ENGINEERING SOLUTION', 'PM services-Dec', '104', '2011-01-03', 'December-2010', 900000, '2011-01-19', '2011-01-20', '2011-01-27', '2011-02-07', '0000-00-00', '0000-00-00', '0000-00-00', '', 'SENT TO PAYABLE', 'sonia.tipu', '09:39:07', '2011-02-08', 'PKR'),
(1549, 'PPO-035806', '', '', 'North', 'SHAQURRI INTERNATIONAL', 'Provision of fuel pipe', '3138', '2011-01-15', 'December-2010', 28000, '2011-01-25', '2011-01-26', '2011-02-21', '2011-02-23', '0000-00-00', '0000-00-00', '0000-00-00', '', 'SENT TO PAYABLE', 'sonia.tipu', '15:14:31', '2011-02-23', 'PKR'),
(1634, 'PPO-035162', '', '', 'North', 'DELTEX COURIER SERVICES', 'Courier Service Charges for Dec/Nov 10', '30011/30010', '2011-02-10', 'December-2010', 11860, '2011-02-11', '0000-00-00', '0000-00-00', '2011-02-15', '0000-00-00', '0000-00-00', '0000-00-00', '', 'SENT TO PAYABLE', 'sonia.tipu', '10:58:07', '2011-02-17', 'PKR'),
(1572, 'PPO-035869', '', '', 'North', 'extreme engineering solutions', 'MAle type connectors for 0.5 inch RFCable', 'EES/CMP/100', '2011-01-03', 'December-2010', 70025, '2011-01-31', '2011-02-02', '2011-02-21', '2011-02-23', '0000-00-00', '0000-00-00', '0000-00-00', '', 'SENT TO PAYABLE', 'sonia.tipu', '15:15:08', '2011-02-23', 'PKR'),
(1575, 'PPO-033009', '', '', 'HQ', 'ZTE Pakistan (Pvt) Ltd', 'claim against o&m services by zte in 10th month (dec-10) of 2nd amendment', '20093812', '2011-01-18', 'December-2010', 307437, '2011-02-01', '2011-02-02', '2011-02-11', '2011-02-15', '0000-00-00', '0000-00-00', '0000-00-00', '', 'SENT TO PAYABLE', 'sonia.tipu', '10:57:40', '2011-02-17', 'USD'),
(1579, 'nill', '', '', 'HQ', 'INSPER', 'service contract for cmpak nw mgmnt software', '110208', '2011-02-10', 'December-2010', 88392, '2011-02-01', '2011-02-02', '2011-02-07', '0000-00-00', '0000-00-00', '0000-00-00', '2011-02-14', '$ Payment 88392', 'SENT TO PAYABLE', 'sonia.tipu', '16:48:01', '2011-02-14', 'USD'),
(1581, 'PPO-036165', '', '', 'C-2', 'MAB FIRE PROTECTION (PVT.) LTD', 'fire extinguisher control panel signa xt and optical smoke detector', 's-195-0111', '2011-01-25', 'December-2010', 78500, '2011-02-01', '2011-02-02', '2011-02-22', '2011-02-25', '0000-00-00', '0000-00-00', '0000-00-00', '', 'SENT TO PAYABLE', 'sonia.tipu', '17:54:12', '2011-02-25', 'PKR'),
(1582, 'PPO-034835', '', '', 'North', 'MAB FIRE PROTECTION (PVT.) LTD', 'maintenance of fire extinguishing sys at jehlum bsc N-JHL-8102', '125-0111', '2011-01-25', 'December-2010', 20000, '2011-02-01', '2011-02-02', '2011-02-14', '0000-00-00', '0000-00-00', '2011-02-15', '0000-00-00', 'naveed anjum', 'SENT TO PAYABLE', 'sonia.tipu', '16:58:00', '2011-02-15', 'PKR'),
(1587, 'PPO-032326', '', '', 'C', 'ZTE Pakistan (Pvt) Ltd', 'consumables and SS jan 10 to feb 10', '20091126', '2010-08-17', 'February-2010', 12702417, '2011-01-31', '0000-00-00', '0000-00-00', '2011-02-08', '0000-00-00', '0000-00-00', '0000-00-00', 'PPO-032326+PPO-033013', 'SENT TO PAYABLE', 'sonia.tipu', '12:51:48', '2011-02-08', 'PKR'),
(1588, 'PPO-033013', '', '', 'C', 'ZTE Pakistan (Pvt) Ltd', 'consumabkes and ss jan10 to feb 10', '20091127', '2010-08-17', 'February-2010', 1751560, '2011-01-31', '0000-00-00', '0000-00-00', '2011-02-08', '0000-00-00', '0000-00-00', '0000-00-00', 'for march', 'SENT TO PAYABLE', 'sonia.tipu', '11:50:14', '2011-02-28', 'PKR'),
(1589, 'PPO-033632', '', '', 'HQ', 'HUAWEI INTERNATIONAL PTE.LTD', 'commercial invoice apr to dec 10', '1100009', '2011-01-18', 'December-2010', 3938294, '2011-01-31', '0000-00-00', '0000-00-00', '2011-02-28', '0000-00-00', '0000-00-00', '0000-00-00', '', 'SENT TO PAYABLE', 'sonia.tipu', '17:58:56', '2011-02-25', 'PKR'),
(1591, 'PPC-036309', '', '', 'North', 'TRC', '100 pair 0.6 ug cable laying patching and testing', 'trc/zong/0001', '2011-02-01', 'December-2010', 1141862, '2011-02-02', '2011-02-02', '2011-03-08', '2011-03-10', '0000-00-00', '0000-00-00', '0000-00-00', 'naveed anjum', 'SENT TO PAYABLE', 'imran.ishaq', '11:02:33', '2011-03-10', 'PKR'),
(1596, 'PPO-036825', '', '', 'South', 'NEW SHAFIQ BROTHERS & CO', 'Shahzore refueling and OT', '15', '2011-02-01', 'January-2011', 178940, '2011-02-03', '0000-00-00', '2011-02-25', '2011-03-04', '0000-00-00', '0000-00-00', '0000-00-00', 'PO awaited', 'SENT TO PAYABLE', 'imran.ishaq', '09:22:50', '2011-03-09', 'PKR'),
(1597, 'PPO-036825', '', '', 'South', 'NEW SHAFIQ BROTHERS & CO', 'shahzore refueling quetta', '07', '2011-02-01', 'January-2011', 42500, '2011-02-03', '0000-00-00', '2011-02-25', '2011-03-04', '0000-00-00', '0000-00-00', '0000-00-00', '', 'SENT TO PAYABLE', 'imran.ishaq', '09:23:26', '2011-03-09', 'PKR'),
(1598, 'PPO-036825', '', '', 'South', 'NEW SHAFIQ BROTHERS & CO', 'shahzore refueling sukker', '16', '2011-02-01', 'January-2011', 220510, '2011-02-03', '0000-00-00', '2011-02-25', '2011-03-04', '0000-00-00', '0000-00-00', '0000-00-00', '', 'SENT TO PAYABLE', 'imran.ishaq', '09:23:50', '2011-03-09', 'PKR'),
(1636, 'PPO-036553', '', '', 'C', 'ZTE Pakistan (Pvt) Ltd', 'Consumables and SS for April 2010 to Dec 2010', '20093-816/815/814/813/463/446', '2011-02-11', 'December-2010', 41634784, '2011-02-11', '0000-00-00', '0000-00-00', '2011-02-15', '0000-00-00', '0000-00-00', '0000-00-00', '', 'SENT TO PAYABLE', 'sonia.tipu', '11:08:26', '2011-02-17', 'PKR'),
(1601, 'PPO-036594', '', '', 'C-1', 'ITTEFAQ COOLING ENGG.', 'services and maintenance of 625 AC split units- Jan', 'ice-0211-0532', '2011-02-01', 'January-2011', 448500, '2011-02-02', '2011-02-04', '2011-03-01', '2011-03-07', '0000-00-00', '0000-00-00', '0000-00-00', '', 'SENT TO PAYABLE', 'imran.ishaq', '11:54:41', '2011-03-08', 'PKR'),
(1602, 'PPO-036594', '', '', 'C', 'ITTEFAQ COOLING ENGG.', 'sservice maintenance of 516 AC split units for jan', 'ice-0211-0533', '2011-02-01', 'January-2011', 387000, '2011-02-04', '2011-02-04', '2011-02-22', '2011-02-25', '0000-00-00', '0000-00-00', '0000-00-00', '', 'SENT TO PAYABLE', 'sonia.tipu', '17:50:07', '2011-02-25', 'PKR'),
(1605, 'PPO-035507', '', '', 'South', 'NEW SHAFIQ BROTHERS & CO', 'hi ace refueling and ot HYD', '06-', '2011-01-22', 'December-2010', 223880, '2011-02-07', '0000-00-00', '2011-02-08', '0000-00-00', '0000-00-00', '2011-02-15', '0000-00-00', '', 'SENT TO PAYABLE', 'sonia.tipu', '11:57:16', '2011-02-15', 'PKR'),
(1610, 'PPO-032321', '', '', 'C-3', 'CELEROS NETWORKS', 'DG maintenance ', '011', '2011-01-31', 'October-2010', 362000, '2011-02-03', '2011-02-08', '0000-00-00', '2011-02-09', '0000-00-00', '0000-00-00', '0000-00-00', 'jahangir zafar', 'SENT TO PAYABLE', 'sonia.tipu', '15:15:27', '2011-02-28', 'PKR'),
(1611, 'PPO-036207', '', '', 'HQ', 'Itel', 'Adapter and Test port cable provision', '2010-0087', '2011-02-08', 'December-2010', 393760, '2011-02-08', '2011-02-08', '0000-00-00', '2011-02-17', '0000-00-00', '0000-00-00', '0000-00-00', 'imran ishaq', 'SENT TO PAYABLE', 'sonia.tipu', '15:34:54', '2011-02-17', 'PKR'),
(1613, 'PPO-034368', '', '', 'North', 'PEOPLE LOGIC', 'consumables', '18', '2011-02-07', 'November-2010', 1212449, '2011-02-08', '2011-02-07', '2011-02-28', '2011-03-07', '0000-00-00', '0000-00-00', '0000-00-00', '', 'SENT TO PAYABLE', 'imran.ishaq', '11:57:27', '2011-03-08', 'PKR'),
(1614, 'PPO-034368', '', '', 'HQ', 'PEOPLE LOGIC', 'Consumables', '19', '2011-02-07', 'November-2010', 709509, '2011-02-07', '2011-02-07', '2011-02-28', '2011-03-07', '0000-00-00', '0000-00-00', '0000-00-00', '', 'SENT TO PAYABLE', 'imran.ishaq', '11:57:41', '2011-03-08', 'PKR'),
(1615, 'PPO-034368', '', '', 'HQ', 'PEOPLE LOGIC', 'consumables', '20', '2011-02-09', 'December-2010', 571377, '2011-02-07', '2011-02-09', '2011-02-28', '2011-03-07', '0000-00-00', '0000-00-00', '0000-00-00', '', 'SENT TO PAYABLE', 'imran.ishaq', '11:58:01', '2011-03-08', 'PKR'),
(1616, 'PPO-035820', '', '', 'North', 'ZULTEC PRIVATE LTD', 'aluminium foil label and zebra ribbon', '2410', '2011-01-26', 'December-2010', 43719, '2011-02-07', '0000-00-00', '2011-02-09', '2011-02-25', '0000-00-00', '0000-00-00', '0000-00-00', '', 'SENT TO PAYABLE', 'sonia.tipu', '17:49:45', '2011-02-25', 'PKR'),
(1628, 'PPO-036363', '', '', 'C-1', 'POLYGON ENTERPRISES', 'Rental for refueling/salary and OT', '1560', '2011-02-10', 'January-2011', 478707, '2011-02-14', '2011-02-14', '2011-03-01', '2011-03-10', '0000-00-00', '0000-00-00', '0000-00-00', 'ayaz ahmed', 'SENT TO PAYABLE', 'imran.ishaq', '10:52:54', '2011-03-10', 'PKR'),
(1629, 'PPO-036363', '', '', 'North', 'POLYGON ENTERPRISES', 'rental  refueling/ ot and salary', '1559', '2011-02-10', 'January-2011', 44600, '2011-02-14', '2011-02-14', '2011-03-17', '2011-03-18', '0000-00-00', '0000-00-00', '0000-00-00', 'hold by region', 'SENT TO PAYABLE', 'imran.ishaq', '16:00:03', '2011-03-18', 'PKR'),
(1638, 'Nill', '', '', 'HQ', 'ZTE Pakistan (Pvt) Ltd', 'DEED OF AMENDMENT II FOR TRANSMISSION DWDM PHASE 1', '20101228', '2010-12-28', 'December-2010', 2335, '2011-01-28', '2011-01-28', '2011-03-04', '2011-03-07', '0000-00-00', '0000-00-00', '0000-00-00', '', 'SENT TO PAYABLE', 'imran.ishaq', '11:52:03', '2011-03-08', 'PKR'),
(1639, 'PPO-035612', '', '', 'North', 'ALCATEL LUCENT', 'O&M for oct 2010 to dec 2010', '86', '2011-01-18', 'December-2010', 27210697, '2011-02-16', '2011-02-18', '2011-03-02', '2011-03-07', '0000-00-00', '0000-00-00', '0000-00-00', '', 'SENT TO PAYABLE', 'imran.ishaq', '11:54:13', '2011-03-08', 'PKR'),
(1640, 'PPO-034781', '', '', 'North', 'ALCATEL LUCENT', 'qtr 2, 25% payment against L2 L3 Post warranty Maintenance Services Contract', '03-Maintenance', '2011-01-03', 'December-2010', 4145864, '2011-02-15', '2011-02-18', '2011-03-14', '2011-03-16', '0000-00-00', '0000-00-00', '0000-00-00', 'Credit note received on 14-03-11', 'SENT TO PAYABLE', 'imran.ishaq', '10:04:29', '2011-03-16', 'PKR'),
(1641, 'PPO-036622', '', '', 'North', 'ZTE Pakistan (Pvt) Ltd', 'O&M services for 11th month of 2nd amendment', '20093826', '2011-02-15', 'January-2011', 307565, '2011-02-18', '2011-02-18', '2011-03-02', '2011-03-07', '0000-00-00', '0000-00-00', '0000-00-00', '', 'SENT TO PAYABLE', 'imran.ishaq', '11:53:09', '2011-03-08', 'USD'),
(1644, 'PPO-036562', '', '', 'HQ', 'MSK ENGINEERING CO.', 'PM of stulz  AC Units', '4028', '2011-02-09', 'January-2011', 340160, '2011-02-14', '2011-02-18', '2011-03-14', '2011-03-17', '0000-00-00', '0000-00-00', '0000-00-00', 'signs missing- Signed by wajid Sb', 'SENT TO PAYABLE', 'imran.ishaq', '09:56:00', '2011-03-18', 'PKR'),
(1646, 'PPO-036692', '', '', 'North', 'HUB ENTERPRISES', 'Supply of Oil Filters and Fuel Filters', '155', '2011-02-11', 'January-2011', 2148026, '2011-02-16', '2011-02-18', '2011-02-23', '2011-02-25', '0000-00-00', '0000-00-00', '0000-00-00', '', 'SENT TO PAYABLE', 'sonia.tipu', '17:52:40', '2011-02-25', 'PKR'),
(1647, 'PPO-036693', '', '', 'North', 'HUB ENTERPRISES', 'Supply of Oil filters and fuel filters', '156', '2011-02-11', 'January-2011', 964881, '2011-02-16', '2011-02-18', '2011-02-23', '2011-02-25', '0000-00-00', '0000-00-00', '0000-00-00', '', 'SENT TO PAYABLE', 'sonia.tipu', '17:52:03', '2011-02-25', 'PKR'),
(1683, 'PPO-036860', '', '', 'North', 'Mirza Jee', 'Vehicle Rent for SHehzore Dala', '1,1A,2,2A,3,3A, 4,5,6,7', '2011-02-22', 'December-2010', 341880, '2011-02-23', '2011-03-01', '2011-03-17', '2011-03-24', '0000-00-00', '0000-00-00', '0000-00-00', 'Jan/ Feb Payment with OT', 'SENT TO PAYABLE', 'sonia.tipu', '11:52:25', '2011-03-24', 'PKR'),
(1659, 'PPO-036619', '', '', 'South', 'PEOPLE LOGIC', 'MANAGED SERVICES', '834', '2011-02-21', 'January-2011', 90342, '2011-02-22', '2011-02-22', '2011-03-02', '2011-03-10', '0000-00-00', '0000-00-00', '0000-00-00', '', 'SENT TO PAYABLE', 'imran.ishaq', '11:02:09', '2011-03-10', 'USD'),
(1661, 'PPO-036554', '', '', 'South', 'CROWN ENGINEERING CORPORATION', 'earthing piy at 0085', '085/002', '2011-02-10', 'February-2011', 40000, '2011-02-22', '0000-00-00', '2011-02-22', '2011-02-25', '0000-00-00', '0000-00-00', '0000-00-00', '', 'SENT TO PAYABLE', 'sonia.tipu', '17:50:31', '2011-02-25', 'PKR'),
(1663, 'PPO-034603', '', '', 'HQ', 'SHELL PAKISTAN LIMITED', 'SUPPLY OF LUBE OIL', '9180176369', '2011-02-21', 'February-2011', 135064, '2011-02-22', '2011-02-22', '2011-02-23', '2011-03-22', '0000-00-00', '0000-00-00', '0000-00-00', '', 'SENT TO PAYABLE', 'sonia.tipu', '16:42:36', '2011-03-22', 'PKR'),
(1664, 'PPO-036024', '', '', 'HQ', 'SHELL PAKISTAN LIMITED', 'SUPPLY OF LUBE OIL', '9180176369-A', '2011-02-21', 'February-2011', 64415, '2011-02-22', '2011-02-22', '2011-02-23', '2011-02-25', '0000-00-00', '0000-00-00', '0000-00-00', 'imran ishaq', 'SENT TO PAYABLE', 'sonia.tipu', '18:02:53', '2011-02-25', 'PKR'),
(1665, 'PPO-036694', '', '', 'HQ', 'SHELL PAKISTAN LIMITED', 'SUPPLY OF LUBE OIL', '9180186355', '2011-02-10', 'February-2010', 366808, '2011-02-22', '2011-02-22', '2011-03-07', '2011-03-10', '0000-00-00', '0000-00-00', '0000-00-00', '', 'SENT TO PAYABLE', 'imran.ishaq', '10:56:54', '2011-03-10', 'PKR'),
(1666, 'PPO-036694', '', '', 'HQ', 'SHELL PAKISTAN LIMITED', 'SUPPLY OF LUBE OIL', '9180186356', '2011-02-10', 'February-2011', 1650596, '2011-02-22', '2011-02-22', '2011-03-07', '2011-03-10', '0000-00-00', '0000-00-00', '0000-00-00', '', 'SENT TO PAYABLE', 'imran.ishaq', '10:57:17', '2011-03-10', 'PKR'),
(1667, 'PPO-036694', '', '', 'HQ', 'SHELL PAKISTAN LIMITED', 'SUPPLY OF LUBE OIL', '9180188779', '2011-02-15', 'February-2011', 35872, '2011-02-22', '2011-02-22', '2011-03-07', '2011-03-10', '0000-00-00', '0000-00-00', '0000-00-00', '', 'SENT TO PAYABLE', 'imran.ishaq', '10:57:33', '2011-03-10', 'PKR'),
(1668, 'PPO-036694', '', '', 'HQ', 'SHELL PAKISTAN LIMITED', 'SUPPLY OF LUBE OIL', '9180188780', '2011-02-15', 'February-2011', 1901235, '2011-02-22', '2011-02-22', '2011-03-07', '2011-03-10', '0000-00-00', '0000-00-00', '0000-00-00', '', 'SENT TO PAYABLE', 'imran.ishaq', '10:57:56', '2011-03-10', 'PKR'),
(1670, 'PPO-036557', '', '', 'C-1', 'PAK ENGG. ENTERPRISES', 'Installation of 25 KVA Transformer 4420', '278', '2011-02-11', 'February-2011', 84000, '2011-02-18', '2011-02-23', '2011-02-28', '2011-03-04', '0000-00-00', '0000-00-00', '0000-00-00', '', 'SENT TO PAYABLE', 'imran.ishaq', '09:18:37', '2011-03-09', 'PKR'),
(1671, 'PPO-036726', '', '', 'North', 'HUB ENTERPRISES', 'Oil filter and fuel filter installation', '158', '2011-02-18', 'January-2011', 472657, '2011-02-21', '2011-02-23', '2011-02-23', '2011-02-25', '0000-00-00', '0000-00-00', '0000-00-00', '', 'SENT TO PAYABLE', 'sonia.tipu', '17:54:52', '2011-02-25', 'PKR'),
(1672, 'PPO-03426', '', '', 'C-2', 'TJ ENTERPRISES', 'Shehzore rent with OT and Salary', 'nill', '2011-02-10', 'January-2011', 262037, '2011-02-23', '0000-00-00', '2011-02-23', '2011-02-25', '0000-00-00', '0000-00-00', '0000-00-00', '', 'SENT TO PAYABLE', 'sonia.tipu', '17:53:21', '2011-02-25', 'PKR'),
(1674, 'PPO-036562', '', '', 'North', 'MSK ENGINEERING CO.', 'PM at zong core locations', '4056', '2011-01-11', 'January-2011', 88934, '2011-02-23', '2011-02-23', '2011-03-02', '2011-03-14', '0000-00-00', '0000-00-00', '0000-00-00', '4026 inv no.', 'SENT TO PAYABLE', 'imran.ishaq', '10:55:05', '2011-03-14', 'PKR'),
(1675, 'PPO-036648', '', '', 'North', 'SAFE HANDS SECURITY SYSTEMS', 'Security Services', '1', '2011-01-27', 'January-2011', 9375995, '2011-02-22', '2011-02-22', '0000-00-00', '2011-02-25', '0000-00-00', '0000-00-00', '0000-00-00', '', 'SENT TO PAYABLE', 'sonia.tipu', '18:02:22', '2011-02-25', 'PKR'),
(1676, 'PPO-036840', '', '', 'C', 'MONARCH SECURITY GUARDS', 'Security Services', 'Nill', '2011-01-25', 'January-2011', 13190252, '2011-02-22', '2011-02-22', '0000-00-00', '2011-02-25', '0000-00-00', '0000-00-00', '0000-00-00', '', 'SENT TO PAYABLE', 'sonia.tipu', '18:02:00', '2011-02-25', 'PKR'),
(1680, 'PPO-036783', '', '', 'North', 'HUB ENTERPRISES', 'Supply of Oil and Fuel Filters', '159', '2011-02-22', 'February-2011', 2449249, '2011-02-24', '2011-02-24', '2011-03-02', '2011-03-07', '0000-00-00', '0000-00-00', '0000-00-00', '', 'SENT TO PAYABLE', 'imran.ishaq', '11:55:46', '2011-03-08', 'PKR'),
(1682, 'PPO-035639', '', '', 'C-2', 'GENERAL SYSTEMS', 'DG PM/CM, Parts and SS', '4342/4344/4343', '2011-01-10', 'December-2010', 606054, '2011-01-24', '2011-01-25', '2011-03-04', '2011-03-14', '0000-00-00', '0000-00-00', '0000-00-00', '', 'SENT TO PAYABLE', 'imran.ishaq', '10:37:50', '2011-03-14', 'PKR'),
(1689, 'PPO-031837', '', '', 'North', 'ZTE Pakistan (Pvt) Ltd', 'Consumables and SS sep 09 tp dec 09', '20090951', '2011-02-02', 'December-2010', 13361656, '2011-02-03', '0000-00-00', '0000-00-00', '2011-02-08', '0000-00-00', '0000-00-00', '0000-00-00', '', 'SENT TO PAYABLE', 'sonia.tipu', '11:53:57', '2011-02-28', 'PKR'),
(1690, 'PPO-036842', '', '', 'South', 'ZIM''S SECURITY (PVT) LTD.', 'Security services', '11', '2011-02-09', 'January-2011', 10927777, '2011-02-28', '2011-02-28', '2011-03-16', '2011-03-17', '0000-00-00', '0000-00-00', '0000-00-00', 'Mukhtar Sb', 'SENT TO PAYABLE', 'imran.ishaq', '09:54:14', '2011-03-18', 'PKR'),
(1692, 'PPO-036573', '', '', 'North', 'DAMCON ENGINEERING SOLUTION', 'DG PM/CM, Parts & S.S', '115116,117', '2011-02-09', 'January-2011', 1705965, '2011-02-28', '0000-00-00', '2011-03-07', '2011-03-07', '0000-00-00', '0000-00-00', '0000-00-00', 'Imran Ishaq', 'SENT TO PAYABLE', 'imran.ishaq', '11:55:22', '2011-03-08', 'PKR'),
(1693, 'PPO-036336', '', '', 'North', 'DAMCON ENGINEERING SOLUTION', 'shahzor rental for refuelling', '111', '2011-02-01', 'January-2011', 557300, '2011-02-28', '0000-00-00', '2011-02-25', '2011-03-07', '0000-00-00', '0000-00-00', '0000-00-00', '', 'SENT TO PAYABLE', 'imran.ishaq', '11:49:51', '2011-03-08', 'PKR'),
(1696, 'PPO-036594', '', '', 'C-2', 'ITTEFAQ COOLING ENGG.', 'AC MAINTINANCE SERVICES', '839', '2011-03-01', 'February-2011', 378000, '2011-03-01', '2011-03-01', '0000-00-00', '2011-03-22', '0000-00-00', '0000-00-00', '0000-00-00', '', 'SENT TO PAYABLE', 'sonia.tipu', '16:43:15', '2011-03-22', 'PKR'),
(1703, 'PPO-035162', '', '', 'North', 'DELTEX COURIER SERVICES', 'Courier charges', '30012', '2011-02-03', 'January-2011', 9910, '2011-03-02', '0000-00-00', '2011-03-02', '2011-03-07', '0000-00-00', '0000-00-00', '0000-00-00', '', 'SENT TO PAYABLE', 'imran.ishaq', '11:50:13', '2011-03-08', 'PKR'),
(1704, 'PPO-036846', '', '', 'North', 'HUB ENTERPRISES', 'supply of oil, fuel and air filter', '160', '2011-02-25', 'February-2011', 4683393, '2011-03-02', '2011-03-02', '2011-03-07', '2011-03-10', '0000-00-00', '0000-00-00', '0000-00-00', '', 'SENT TO PAYABLE', 'imran.ishaq', '10:53:23', '2011-03-10', 'PKR'),
(1706, 'PPO-036363', '', '', 'North', 'POLYGON ENTERPRISES', 'Rental/driver Salary/OT', '1561', '2011-03-02', 'February-2011', 44600, '2011-03-02', '2011-03-03', '2011-03-08', '2011-03-18', '0000-00-00', '0000-00-00', '0000-00-00', 'wait for completion  jan payment', 'SENT TO PAYABLE', 'imran.ishaq', '16:01:36', '2011-03-18', 'PKR'),
(1707, 'PPO-036363', '', '', 'C-1', 'POLYGON ENTERPRISES', 'Rental/Drivers salary and OT', '1562', '2011-03-02', 'February-2011', 486142, '2011-03-03', '2011-03-03', '2011-03-08', '2011-03-10', '0000-00-00', '0000-00-00', '0000-00-00', '', 'SENT TO PAYABLE', 'imran.ishaq', '11:46:03', '2011-03-14', 'PKR'),
(1708, 'PPO-036336', '', '', 'North', 'DAMCON ENGINEERING SOLUTION', 'Shahzire Rent, 4x4 jeep Rent,Driver OT', '119', '2011-03-01', 'February-2011', 557300, '2011-03-02', '2011-03-03', '2011-03-08', '2011-03-10', '0000-00-00', '0000-00-00', '0000-00-00', '', 'SENT TO PAYABLE', 'imran.ishaq', '11:00:41', '2011-03-10', 'PKR'),
(1709, 'PPO-036428', '', '', 'South', 'NEW SHAFIQ BROTHERS & CO', 'HI-Ace Vehicle for Re-fueling', 'SAB-Zong-08', '2011-02-25', 'January-2011', 219000, '2011-03-02', '0000-00-00', '0000-00-00', '2011-03-07', '0000-00-00', '0000-00-00', '0000-00-00', '', 'SENT TO PAYABLE', 'imran.ishaq', '11:51:17', '2011-03-08', 'PKR'),
(1710, 'PPO-036428', '', '', 'South', 'NEW SHAFIQ BROTHERS & CO', 'Hi-Ace- Vehicles fr Refueling/OT', 'Sab-Zong-07-JAn', '2011-02-17', 'January-2011', 74000, '2011-03-02', '2011-03-02', '2011-03-03', '2011-03-07', '0000-00-00', '0000-00-00', '0000-00-00', 'Imran ishaq', 'senT TO PAYABLE', 'imran.ishaq', '10:36:51', '2011-03-14', 'PKR'),
(1717, 'PPO-036672', '', '', 'South', 'FLOWTECH RAWALPINDI', 'Stale locks and Nadeem Locks', '113', '2011-02-22', 'February-2011', 139230, '2011-03-07', '0000-00-00', '2011-03-07', '2011-03-10', '0000-00-00', '0000-00-00', '0000-00-00', '', 'SENT TO PAYABLE', 'imran.ishaq', '11:03:43', '2011-03-10', 'PKR'),
(1718, 'PPO-035591', '', '', 'South', 'AK ELECTRONICS', 'Genset Overhauling at 0497', '142', '2011-01-27', 'March-2011', 125000, '2011-03-07', '0000-00-00', '2011-03-07', '2011-03-10', '0000-00-00', '0000-00-00', '0000-00-00', '', 'SENT TO PAYABLE', 'imran.ishaq', '11:03:05', '2011-03-10', 'PKR'),
(1719, 'PPO-034710', '', '', 'South', 'INNOVATIVE ENGINEERING', 'Installation of PTs, Connection of bus bar at MSC Khi', 'IE-2010/386', '2010-09-22', 'September-2010', 126000, '2011-03-07', '0000-00-00', '2011-03-07', '2011-03-10', '0000-00-00', '0000-00-00', '0000-00-00', '', 'SENT TO PAYABLE', 'imran.ishaq', '11:05:01', '2011-03-10', 'PKR'),
(1721, 'PPO-036694', '', '', 'North', 'SHELL PAKISTAN LIMITED', 'supply of lube oil', '9180187809', '2011-02-14', 'February-2011', 1447442, '2011-03-02', '2011-03-02', '2011-03-07', '2011-03-10', '0000-00-00', '0000-00-00', '0000-00-00', '', 'SENT TO PAYABLE', 'imran.ishaq', '10:58:13', '2011-03-10', 'PKR'),
(1722, 'PPO-036694', '', '', 'North', 'SHELL PAKISTAN LIMITED', 'supply of lube oil', '9180185731', '2011-02-10', 'February-2011', 1648297, '2011-03-02', '2011-03-02', '2011-03-07', '2011-03-10', '0000-00-00', '0000-00-00', '0000-00-00', '', 'SENT TO PAYABLE', 'imran.ishaq', '10:58:32', '2011-03-10', 'PKR'),
(1723, 'PPO-036694', '', '', 'North', 'SHELL PAKISTAN LIMITED', 'supply of lube oil', '9180185730', '2011-02-09', 'February-2011', 1648297, '2011-03-02', '2011-03-02', '2011-03-07', '2011-03-10', '0000-00-00', '0000-00-00', '0000-00-00', '', 'SENT TO PAYABLE', 'imran.ishaq', '10:58:46', '2011-03-10', 'PKR'),
(1724, 'PPO-036694', '', '', 'North', 'SHELL PAKISTAN LIMITED', 'supply of lube oil', '9180187808', '2011-02-14', 'February-2011', 341846, '2011-03-02', '2011-03-02', '2011-03-07', '2011-03-10', '0000-00-00', '0000-00-00', '0000-00-00', '', 'SENT TO PAYABLE', 'imran.ishaq', '10:59:02', '2011-03-10', 'PKR'),
(1725, 'PPO-036694', '', '', 'North', 'SHELL PAKISTAN LIMITED', 'supply of lube oil', '9180187810', '2011-02-14', 'February-2011', 357400, '2011-03-02', '2011-03-02', '2011-03-07', '2011-03-10', '0000-00-00', '0000-00-00', '0000-00-00', '', 'SENT TO PAYABLE', 'imran.ishaq', '10:59:23', '2011-03-10', 'PKR'),
(1726, 'PPO-036384', '', '', 'HQ', 'MODERN BATTERY SERVICE STATION', 'SUPPLY OF BATTERIES', '13700', '2011-03-03', 'January-2011', 135720, '2011-03-08', '2011-03-08', '2011-03-14', '2011-03-16', '0000-00-00', '0000-00-00', '0000-00-00', '', 'SENT TO PAYABLE', 'imran.ishaq', '10:05:22', '2011-03-16', 'PKR'),
(1732, 'PPO-036263', '', '', 'North', 'MULTI TECH', 'REPAIRING OG DG SET AT SITE 8228, 8709, 8544, 8708, 8611', '11', '2011-03-03', 'January-2011', 218400, '2011-03-07', '2011-03-08', '2011-03-17', '2011-03-18', '0000-00-00', '0000-00-00', '0000-00-00', '03 sites ok from 5 istes 8709,8544,8611', 'SENT TO PAYABLE', 'imran.ishaq', '16:02:29', '2011-03-18', 'PKR'),
(1736, 'Nill', '', '', 'C-1', 'GMK CONSTRUCTIONS', 'ELECTRICITY BILLS', 'NILL', '2010-12-29', 'December-2010', 156842, '2011-03-09', '2011-03-09', '0000-00-00', '2011-03-16', '0000-00-00', '0000-00-00', '0000-00-00', 'SITE IDS 7794,7493,7865,7906,7867,7833,7826,6734', 'SENT TO PAYABLE', 'imran.ishaq', '16:46:13', '2011-03-16', 'PKR'),
(1738, 'PPO-036648', '', '', 'North', 'SAFE HANDS SECURITY SYSTEMS', 'Security Services', '02-11', '2011-02-22', 'FEBUARY-11', 10283127, '2011-03-10', '2011-03-10', '2011-03-10', '2011-03-14', '0000-00-00', '0000-00-00', '0000-00-00', '', 'SENT TO PAYABLE', 'imran.ishaq', '11:01:46', '2011-03-14', 'PKR'),
(1741, 'Nill', '', '', 'North', 'BILAL ANWAR KHAN', 'petty cash', 'NILL', '2011-03-10', 'March-2011', 277292, '2011-03-11', '2011-03-11', '0000-00-00', '2011-03-16', '0000-00-00', '0000-00-00', '0000-00-00', '', 'SENT TO PAYABLE', 'imran.ishaq', '10:03:28', '2011-03-16', 'PKR'),
(1743, 'PPO-034783', '', '', 'HQ', 'ALCATEL LUCENT SHANGHAI BELL CO. LTD', 'POST WARRANTY MAINTINANCE Q2', 'MAINTINANCE-003', '2010-11-08', 'June-2010', 192753, '2011-03-08', '2011-03-09', '2011-03-11', '2011-03-16', '0000-00-00', '0000-00-00', '0000-00-00', '25% PAYMENT AS PER CONTRACT', 'SENT TO PAYABLE', 'imran.ishaq', '10:04:56', '2011-03-16', 'USD'),
(1746, 'PPO-036840', '', '', 'C', 'MONARCH SECURITY GUARDS', 'Security Services', 'NILL', '2011-02-08', 'February-2011', 15976103, '2011-03-14', '2011-03-14', '0000-00-00', '2011-03-17', '0000-00-00', '0000-00-00', '0000-00-00', '', 'SENT TO PAYABLE', 'sonia.tipu', '17:43:23', '2011-03-21', 'PKR'),
(1753, 'NILL', '', '', 'C-1', 'AYAZ AHMED', 'petty cash', 'NILL', '2011-03-11', 'March-2011', 54076, '2011-03-16', '2011-03-16', '0000-00-00', '0000-00-00', '0000-00-00', '2011-03-16', '0000-00-00', '', 'SENT TO PAYABLE', 'sonia.tipu', '17:39:54', '2011-03-21', 'PKR'),
(1779, 'nill', '', '', 'C-1', 'GEPCO', 'e.bill-Advance for the month of March', 'nill', '2011-03-18', 'March-2011', 6216235, '2011-03-22', '0000-00-00', '0000-00-00', '2011-03-24', '0000-00-00', '0000-00-00', '0000-00-00', '', 'SENT TO PAYABLE', 'sonia.tipu', '11:53:08', '2011-03-24', 'PKR'),
(1754, 'PPO-036921', '', '', 'South', 'CAPITAL ENGINEERING', 'MOBILE DG LOADING,UNLOADING & TRANSPORTATION', 'NILL', '2011-03-13', 'February-2011', 12000, '2011-03-16', '2011-03-16', '0000-00-00', '2011-03-17', '0000-00-00', '0000-00-00', '0000-00-00', '', 'SENT TO PAYABLE', 'imran.ishaq', '09:53:25', '2011-03-18', 'PKR'),
(1767, 'PPO-034324', '', '', 'C-1', 'TJ ENTERPRISES', 'Shahzore rent with driver Salary & OT', 'NILL', '2011-01-08', 'December-2010', 177110, '2011-03-17', '2011-03-17', '0000-00-00', '2011-03-21', '0000-00-00', '0000-00-00', '0000-00-00', '', 'SENT TO PAYABLE', 'sonia.tipu', '12:59:04', '2011-03-21', 'PKR'),
(1768, 'PPO-036426', '', '', 'C-1', 'TJ ENTERPRISES', 'Shahzore rent with driver Salary & OT', 'NILL', '2011-03-09', 'jan/Feb-2011', 356008, '2011-03-17', '2011-03-17', '2011-03-17', '2011-03-21', '0000-00-00', '0000-00-00', '0000-00-00', 'JAN/FEB-11 PAYMENT', 'SENT TO PAYABLE', 'sonia.tipu', '12:56:30', '2011-03-21', 'PKR'),
(1774, 'PPO-036876', '', '', 'South', 'POWERLINK COMMUNICATION', 'REPAIRING/INSTALL OF TRANSFORMER AT SITE 1561', '21', '2011-03-04', 'March-2011', 35000, '2011-03-18', '2011-03-18', '0000-00-00', '2011-03-22', '0000-00-00', '0000-00-00', '0000-00-00', '', 'SENT TO PAYABLE', 'sonia.tipu', '16:40:08', '2011-03-22', 'PKR'),
(1775, 'PPO-036954', '', '', 'South', 'POWERLINK COMMUNICATION', 'REPAIRING OF TRANSFORMER AT SITE 1694', '22', '2011-03-10', 'March-2011', 25000, '2011-03-18', '2011-03-18', '0000-00-00', '2011-03-22', '0000-00-00', '0000-00-00', '0000-00-00', '', 'SENT TO PAYABLE', 'sonia.tipu', '16:45:56', '2011-03-22', 'PKR'),
(1776, 'PPC-032058', '', '', 'North', 'ATAAS HOLDINGS', 'SUPPLY & INSTALL OF 30KVA LINE CONDITIONER', '550022/11', '2011-03-09', 'March-2011', 2195017, '2011-03-18', '2011-03-18', '2011-03-21', '2011-03-24', '0000-00-00', '0000-00-00', '0000-00-00', '', 'SENT TO PAYABLE', 'sonia.tipu', '11:52:52', '2011-03-24', 'PKR'),
(1778, 'nill', '', '', 'C-3', 'PAF MUSHAF BASE SARGODHA', 'E.bill 7767/7768', 'nill', '2011-03-17', 'February-2011', 39926, '2011-03-21', '0000-00-00', '0000-00-00', '2011-03-22', '0000-00-00', '0000-00-00', '0000-00-00', '', 'SENT TO PAYABLE', 'sonia.tipu', '16:41:52', '2011-03-22', 'PKR'),
(1781, 'nill', '', '', 'South', 'HESCO', 'E.Bill-Advance for March 2011', 'nill', '2011-03-17', 'March-2011', 12619022, '2011-03-22', '0000-00-00', '0000-00-00', '2011-03-24', '0000-00-00', '0000-00-00', '0000-00-00', '', 'SENT TO PAYABLE', 'sonia.tipu', '11:52:04', '2011-03-24', 'PKR');

check this query

SELECT  `SRNo` ,  `InvAmount` ,  `SubPayDate` ,  `PayRetDate` ,  `ResubPayDate` , 
CASE WHEN  `ResubPayDate` =  '0000-00-00'
THEN TO_DAYS( NOW( ) ) - TO_DAYS(  `SubPayDate` ) 
ELSE TO_DAYS( NOW( ) ) - TO_DAYS(  `ResubPayDate` ) 
END Days
FROM  `invmain` 
WHERE  `Status` =  'SENT TO PAYABLE'
AND  `SubPayDate` <>  '0000-00-00'

I do not know how you want payretdate in query so I have not used it

Thanks Friend, PayretDate is not important in this case, thanks.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.