Sunday, November 15, 2020

Tyres Purchase / Procurement Process in Qatar

These information are based on my experience working with Pirelli Tyres and Equipment Centre Qatar. Here we are importing different kind of brand like for tyres Pirelli , Federal , Deestone , Diamondback, Boto, Gripmax, Odyking, Tracmax, Doubleking, Nison, Hilo, Saferich, Onyx, Green Dragon, Wellplus, Doupro, Gold Dove, Gold Sheild etc for Tubes like Dongah Tubes, for Batteries like Koreana Batteries, For Lubricant like Mannol Oils, Total Oils, for the Automotive equipment like Corghi, Velyin, Borlan, Airmac.

I'm trying to explain the full procurement process of tyres from overseas (USA, UK, Germany, Russia, Romania, Mexico, Brazil, Italy, Turkey, Thailand, Taiwan, and , China ) to Qatar. 

1. Purchase Order

2. Open Letter of Credit (LC) with Qatar Bank

3. Book Shipments if Purchase order is FOB. When booking a shipment always ask your agent to give minimum 14 days of free line demmurage charges so you can avoid any extra charges in case of your goods stuck at port for some time due to any unforeseen issue. Request supplier to send Commercial Invoice, Packing  List, Certificate of Origin, Master Bill of Lading and Shipping Certificates to submit to his bank at origin maximum within 7-10 days of vessel departure from the origin port so it can come early to the importer bank in Qatar and documents can be taken from the bank before the shipment arrival. Commercial Invoice must be attested from the chamber of commerce at the origin.

4. Track Shipment and Documents for shipped order

5. Request for Cheques and Contracts from the Bank earlier before 3-4 days of shipment arrival in Qatar.

6. Submit Signed Cheques and Contract back to the Bank with Arrival Notice of the shipment

7. Request for the Original Documents from the Bank

8. Request for Delivery Order from Local office of Shipping line

9. Prepare GSO certificates for the GSO required items

10. Prepare Arabic Letters

11. Submit Full set of the documents to your clearing agency on the day of shipment arrival as all the process have been done earlier as per above.

12. Pay Custom Duty

13. Release to your warehouse within 7 days of the shipment arrival in Qatar as Hamad port only providing 7 days free port charges on tyres.

GCC Certificates (GSO) will be required only for the Car tyres (PCR, 4x4) and Heavy Truck Tyres (TBR). 

As per new Qatar rules for GCC certificates Motorbike tyres also required GCC certificate for the customs clearance.

OTR Tyre like Industrial Tyres , Agricultural Tyres , Forklift Tyres does not required a GCC certificates.




Thursday, December 11, 2014

Search entire SQL Server database and all tables for a specified string

-- =============================================
-- Author:        <Jainul Khan>
-- Create date: <11-12-2014>
-- Description: <Search entire SQL Server database and all tables for a specified string>
-- =============================================
-- [dbo].[sp_SearchFromAllTables] 'Entered'
CREATE PROCEDURE sp_SearchFromAllTables ( @SearchStr nvarchar(100) )
AS
BEGIN

DECLARE @Results TABLE(ColumnName nvarchar(370), ColumnValue nvarchar(3630))

SET NOCOUNT ON

DECLARE @TableName nvarchar(256), @ColumnName nvarchar(128), @SearchStr2 nvarchar(110)
SET  @TableName = ''
SET @SearchStr2 = QUOTENAME('%' + @SearchStr + '%','''')

WHILE @TableName IS NOT NULL
BEGIN
    SET @ColumnName = ''
    SET @TableName =
    (
        SELECT MIN(QUOTENAME(TABLE_SCHEMA) + '.' + QUOTENAME(TABLE_NAME))
        FROM    INFORMATION_SCHEMA.TABLES
        WHERE       TABLE_TYPE = 'BASE TABLE'
            AND QUOTENAME(TABLE_SCHEMA) + '.' + QUOTENAME(TABLE_NAME) > @TableName
            AND OBJECTPROPERTY(
                    OBJECT_ID(
                        QUOTENAME(TABLE_SCHEMA) + '.' + QUOTENAME(TABLE_NAME)
                         ), 'IsMSShipped'
                           ) = 0
    )

    WHILE (@TableName IS NOT NULL) AND (@ColumnName IS NOT NULL)
    BEGIN
        SET @ColumnName =
        (
            SELECT MIN(QUOTENAME(COLUMN_NAME))
            FROM    INFORMATION_SCHEMA.COLUMNS
            WHERE       TABLE_SCHEMA    = PARSENAME(@TableName, 2)
                AND TABLE_NAME  = PARSENAME(@TableName, 1)
                AND DATA_TYPE IN ('char', 'varchar', 'nchar', 'nvarchar')
                AND QUOTENAME(COLUMN_NAME) > @ColumnName
        )

        IF @ColumnName IS NOT NULL
        BEGIN
            INSERT INTO @Results
            EXEC
            (
                'SELECT ''' + @TableName + '.' + @ColumnName + ''', LEFT(' + @ColumnName + ', 3630)
                FROM ' + @TableName + ' (NOLOCK) ' +
                ' WHERE ' + @ColumnName + ' LIKE ' + @SearchStr2
            )
        END
    END
END

SELECT ColumnName, ColumnValue FROM @Results

END

Tuesday, December 9, 2014

Extended Date Formats in SQL Server

Here are some more date formats that does not come standard in SQL Server as part of the CONVERT function.
Extended Date Formats
Date Format
SQL Statement
Sample Output
YY-MM-DD
SELECT SUBSTRING(CONVERT(VARCHAR(10), GETDATE(), 120), 3, 8) AS [YY-MM-DD]
SELECT REPLACE(CONVERT(VARCHAR(8), GETDATE(), 11), '/', '-') AS [YY-MM-DD]
99-01-24
YYYY-MM-DD
SELECT CONVERT(VARCHAR(10), GETDATE(), 120) AS [YYYY-MM-DD]
SELECT REPLACE(CONVERT(VARCHAR(10), GETDATE(), 111), '/', '-') AS [YYYY-MM-DD]
1999-01-24
MM/YY
SELECT RIGHT(CONVERT(VARCHAR(8), GETDATE(), 3), 5) AS [MM/YY]
SELECT SUBSTRING(CONVERT(VARCHAR(8), GETDATE(), 3), 4, 5) AS [MM/YY]
08/99
MM/YYYY
SELECT RIGHT(CONVERT(VARCHAR(10), GETDATE(), 103), 7) AS [MM/YYYY]
12/2005
YY/MM
SELECT CONVERT(VARCHAR(5), GETDATE(), 11) AS [YY/MM]
99/08
YYYY/MM
SELECT CONVERT(VARCHAR(7), GETDATE(), 111) AS [YYYY/MM]
2005/12
Month DD, YYYY 1
SELECT DATENAME(MM, GETDATE()) + RIGHT(CONVERT(VARCHAR(12), GETDATE(), 107), 9) AS [Month DD, YYYY]
July 04, 20061
Mon YYYY 1
SELECT SUBSTRING(CONVERT(VARCHAR(11), GETDATE(), 113), 4, 8) AS [Mon YYYY]
Apr 2006 1
Month YYYY1
SELECT DATENAME(MM, GETDATE()) + ' ' + CAST(YEAR(GETDATE()) AS VARCHAR(4)) AS [Month YYYY]
February 20061
DD Month 1
SELECT CAST(DAY(GETDATE()) AS VARCHAR(2)) + ' ' + DATENAME(MM, GETDATE()) AS [DD Month]
11 September1
Month DD 1
SELECT DATENAME(MM, GETDATE()) + ' ' + CAST(DAY(GETDATE()) AS VARCHAR(2)) AS [Month DD]
September 111
DD Month YY 1
SELECT CAST(DAY(GETDATE()) AS VARCHAR(2)) + ' ' + DATENAME(MM, GETDATE()) + ' ' + RIGHT(CAST(YEAR(GETDATE()) AS VARCHAR(4)), 2) AS [DD Month YY]
19 February 72 1
DD Month YYYY 1
SELECT CAST(DAY(GETDATE()) AS VARCHAR(2)) + ' ' + DATENAME(MM, GETDATE()) + ' ' + CAST(YEAR(GETDATE()) AS VARCHAR(4)) AS [DD Month YYYY]
11 September 2002 1
MM-YY
SELECT RIGHT(CONVERT(VARCHAR(8), GETDATE(), 5), 5) AS [MM-YY]
SELECT SUBSTRING(CONVERT(VARCHAR(8), GETDATE(), 5), 4, 5) AS [MM-YY]
12/92
MM-YYYY
SELECT RIGHT(CONVERT(VARCHAR(10), GETDATE(), 105), 7) AS [MM-YYYY]
05-2006
YY-MM
SELECT RIGHT(CONVERT(VARCHAR(7), GETDATE(), 120), 5) AS [YY-MM]
SELECT SUBSTRING(CONVERT(VARCHAR(10), GETDATE(), 120), 3, 5) AS [YY-MM]
92/12
YYYY-MM
SELECT CONVERT(VARCHAR(7), GETDATE(), 120) AS [YYYY-MM]
2006-05
MMDDYY
SELECT REPLACE(CONVERT(VARCHAR(10), GETDATE(), 1), '/', '') AS [MMDDYY]
122506
MMDDYYYY
SELECT REPLACE(CONVERT(VARCHAR(10), GETDATE(), 101), '/', '') AS [MMDDYYYY]
12252006
DDMMYY
SELECT REPLACE(CONVERT(VARCHAR(10), GETDATE(), 3), '/', '') AS [DDMMYY]
240702
DDMMYYYY
SELECT REPLACE(CONVERT(VARCHAR(10), GETDATE(), 103), '/', '') AS [DDMMYYYY]
24072002
Mon-YY 1
SELECT REPLACE(RIGHT(CONVERT(VARCHAR(9), GETDATE(), 6), 6), ' ', '-') AS [Mon-YY]
Sep-02 1
Mon-YYYY 1
SELECT REPLACE(RIGHT(CONVERT(VARCHAR(11), GETDATE(), 106), 8), ' ', '-') AS [Mon-YYYY]
Sep-2002 1
DD-Mon-YY1
SELECT REPLACE(CONVERT(VARCHAR(9), GETDATE(), 6), ' ', '-') AS [DD-Mon-YY]
25-Dec-05 1
DD-Mon-YYYY 1
SELECT REPLACE(CONVERT(VARCHAR(11), GETDATE(), 106), ' ', '-') AS [DD-Mon-YYYY]
25-Dec-20051
1 To make the month name in upper case, simply use the UPPER string function. 

Monday, December 1, 2014

ASPxGridView - Enable Disable commandbuttons with conditions in AspxGridView

protected void grid1_CommandButtonInitialize(object sender, ASPxGridViewCommandButtonEventArgs e)
        {

            if (e.VisibleIndex == -1)
                return;
            if (e.ButtonType == ColumnCommandButtonType.Edit)
            {
                e.Enabled = EditButtonVisibleCriteria((ASPxGridView)sender, e.VisibleIndex);
            }


        }
        private bool EditButtonVisibleCriteria(ASPxGridView grid, int visibleIndex)
        {
            object row = grid.GetRow(visibleIndex);
            return ((DataRowView)row)["Status"].ToString().Contains("Entered");

        }

Wednesday, October 22, 2014

Sys.WebForms.PageRequestManagerParserErrorException: DevExpress

What's a PageRequestManagerParserErrorException?
The UpdatePanel control uses asynchronous postbacks to control which parts of the page get rendered. It does this using a whole bunch of JavaScript on the client and a whole bunch of C# on the server. Asynchronous postbacks are exactly the same as regular postbacks except for one important thing: the rendering. Asynchronous postbacks go through the same life cycles events as regular pages (this is a question I get asked often). Only at the render phase do things get different. We capture the rendering of only the UpdatePanels that we care about and send it down to the client using a special format. In addition, we send out some other pieces of information, such as the page title, hidden form values, the form action URL, and lists of scripts.
As I mentioned, this is rendered out using a special format that the JavaScript on the client can understand. If you mess with the format by rendering things outside of the render phase of the page, the format will be messed up. Perhaps the most common way to do this is to call Response.Write() during Page's Load event, which is something that page developers often do for debugging purposes.
The client ends up receiving a blob of data that it can't parse, so it gives up and shows you a PageRequestManagerParserErrorException. Here's an example of what the message contains:

How do I avoid getting a PageRequestManagerParserErrorException?
       protected void Page_Init(object sender, EventArgs e)
        {          

                RegisterPostBackControl();
           
        }

        private void RegisterPostBackControl()
        {
            ScriptManager.RegisterPostBackControl(pageControl);
        }

Saturday, September 13, 2014

Find and Replace Values in All Tables and All Text Columns using SQL Server

DECLARE @stringToFind VARCHAR(100)
DECLARE @stringToReplace VARCHAR(100)
DECLARE @schema sysname
DECLARE @table sysname
DECLARE @count INT
DECLARE @sqlCommand VARCHAR(8000)
DECLARE @where VARCHAR(8000)
DECLARE @columnName sysname
DECLARE @object_id INT
                    
SET @stringToFind = 'Smith'
SET @stringToReplace = 'Jones'
                       
DECLARE TAB_CURSOR CURSOR  FOR
SELECT   B.NAME      AS SCHEMANAME,
         A.NAME      AS TABLENAME,
         A.OBJECT_ID
FROM     sys.objects A
         INNER JOIN sys.schemas B
           ON A.SCHEMA_ID = B.SCHEMA_ID
WHERE    TYPE = 'U'
ORDER BY 1
         
OPEN TAB_CURSOR

FETCH NEXT FROM TAB_CURSOR
INTO @schema,
     @table,
     @object_id
     
WHILE @@FETCH_STATUS = 0
  BEGIN
    DECLARE COL_CURSOR CURSOR FOR
    SELECT A.NAME
    FROM   sys.columns A
           INNER JOIN sys.types B
             ON A.SYSTEM_TYPE_ID = B.SYSTEM_TYPE_ID
    WHERE  OBJECT_ID = @object_id
           AND IS_COMPUTED = 0
           AND B.NAME IN ('char','nchar','nvarchar','varchar','text','ntext')

    OPEN COL_CURSOR
    
    FETCH NEXT FROM COL_CURSOR
    INTO @columnName
    
    WHILE @@FETCH_STATUS = 0
      BEGIN
        SET @sqlCommand = 'UPDATE ' + @schema + '.' + @table + ' SET [' + @columnName
                           + '] = REPLACE(convert(nvarchar(max),[' + @columnName + ']),'''
                           + @stringToFind + ''',''' + @stringToReplace + ''')'
        
        SET @where = ' WHERE [' + @columnName + '] LIKE ''%' + @stringToFind + '%'''
        
        EXEC( @sqlCommand + @where)
        
        SET @count = @@ROWCOUNT
        
        IF @count > 0
          BEGIN
            PRINT @sqlCommand + @where
            PRINT 'Updated: ' + CONVERT(VARCHAR(10),@count)
            PRINT '----------------------------------------------------'
          END
        
        FETCH NEXT FROM COL_CURSOR
        INTO @columnName
      END
    
    CLOSE COL_CURSOR
    DEALLOCATE COL_CURSOR
    
    FETCH NEXT FROM TAB_CURSOR
    INTO @schema,
         @table,
         @object_id
  END
  
CLOSE TAB_CURSOR
DEALLOCATE TAB_CURSOR