Hi All,
Tax Authorities in Pakistan have asked all the restaurants to integrate their softwares with Restaurant Invoice Monitoring System (RIMS). And provided sample codes for different languages like C#, Java, JavaScript, Php etc.
It is basically a REST API where our software needs to send details of every sale.
function sendWebCli() {
var lib = host.lib("System");
var wc = new lib.System.Net.WebClient();
var URI = "http://rims.punjab.gov.pk/api/databaseupdate/formdata";
var myParameters = "whatever (your data looks like JSON)";
wc.Headers[HttpRequestHeader.ContentType] = "application/x-www-form-urlencoded";
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not sure about this part
var HtmlResult = wc.UploadString(URI, myParameters);
}
You can also achieve the FBR request via the database following methods:
First of all we need to create a new table in your database. Datatype of Column BillNo should match the data type of the column you are using to store billNo/InvoiceNO.
Secondly we need to create a trigger on your invoice table in which you are storing details of invoice mainly total amount, GST , Invoice number and invoice date. This trigger will send your invoice details in my table.
CREATE TRIGGER [dbo].[trgFBR_InvoiceUpd]
ON [dbo].[yourtablename]
AFTER INSERT AS
DECLARE @BillNo nvarchar (100)
SELECT @BillNo= yourInvoiceColumn FROM INSERTED;
IF NOT EXISTS (SELECT BillNo FROM FBR_Table WHERE billno=@BillNo)
INSERT INTO FBR_Table (BillNo, Transmitted) VALUES (@BillNo,0);
GO
Thirdly we need to create a user for our work and allow access to that user.
USE [master]
exec sp_addlogin 'FBR', 'FBR'
USE POS
exec sp_adduser 'FBR', 'FBR'