Tuesday, December 26, 2023

Next Report: Update Table

 


step 1: 


declare @sql varchar(max);



DECLARE @DateName nvarchar(100)


SET @DateName=  '[NextReport].[dbo].NXTRPTEmployeeProfile_' + CAST( GetDate()  as NVARCHAR(12) );

SELECT @DateName = REPLACE(@DateName, ' ', '')

 --SELECT @DateName

 Set @sql = 'SELECT * INTO ' +  @DateName +' FROM [NextReport].[dbo].NXTRPTEmployeeProfile ';


 EXECUTE(@sql)

 

 

 step 2: 

 

 Drop Table [NextReport].[dbo].[NXTRPTEmployeeProfile]

 

 

 Step: 

 if (SELECT count(1) FROM NXTActiveEmployee) > 0

BEGIN

SELECT 1

END

ELSE

BEGIN

TRUNCATE TABLE NXTActiveEmployee


INSERT INTO NXTActiveEmployee

SELECT EmployeeCode FROM Employee WHERE EmployeeStatus = 'A'

   

   END


Sunday, December 17, 2023

All Steps For Next Report Table Update

 



--Step : 1


declare @sql varchar(max);



DECLARE @DateName nvarchar(100)


SET @DateName=  'NXTRPTEmployeeProfile' + CAST( GetDate()  as NVARCHAR(12) );

SELECT @DateName = REPLACE(@DateName, ' ', '')

 

 Set @sql = 'SELECT * INTO ' +  @DateName +' FROM NXTRPTEmployeeProfile ';


 EXECUTE(@sql)




 --step 2: 


 Drop Table NXTRPTEmployeeProfile


 --step 3:


 SELECT * INTO NXTRPTEmployeeProfile FROM EmpProfile

 

NextReport Update Table

 declare @sql varchar(max);



DECLARE @DateName nvarchar(100)


SET @DateName=  '[NextReport].[dbo].NXTRPTEmployeeProfile' + CAST( GetDate()  as NVARCHAR(12) );

SELECT @DateName = REPLACE(@DateName, ' ', '')

 --SELECT @DateName

 Set @sql = 'SELECT * INTO ' +  @DateName +' FROM [NextReport].[dbo].NXTRPTEmployeeProfile ';


 EXECUTE(@sql)



 

Backup Tables by Date

 


declare @sql varchar(max);



DECLARE @DateName nvarchar(100)


SET @DateName=  'NXTRPTEmployeeProfile' + CAST( GetDate()  as NVARCHAR(12) );

SELECT @DateName = REPLACE(@DateName, ' ', '')

 

 Set @sql = 'SELECT * INTO ' +  @DateName +' FROM NXTRPTEmployeeProfile ';


 EXECUTE(@sql)


Thursday, August 31, 2023

httpclient request with Access Token and payloads:

 httpclient request with Access Token and payloads:



 var param = new

            {


                documentNumber = "1317915213594",

                motherName = "Amena",

                dateOfBirth = "01/23/1985"


            };

var dataString = JsonConvert.SerializeObject(param);

            string accessToken_ = userDatas.accessToken;


            var client = new HttpClient();

            var request = new HttpRequestMessage(HttpMethod.Post, "http://104.198.53.36:8080/UW/app/erp/duplicationCheck");

            request.Headers.Add("Authorization", accessToken_);

            var content_ = new StringContent(dataString, null, "application/json");

            request.Content = content_;

            var response_ = await client.SendAsync(request);

            response_.EnsureSuccessStatusCode();


Monday, August 14, 2023

Knowledge

 Knowledge itself is a potential power. Knowledge combined with action is real power. 

Wednesday, August 9, 2023

Saturday, July 15, 2023

Remove Mandatory field from model

Remove the Mandatory field from the model:                


ModelState.Remove("SyncMonth");

ModelState.Remove("NotSyncMonth");


            if (!ModelState.IsValid)

                return GetErrorMessageResult("Warning! You must fill all the required fields");


Wednesday, June 14, 2023

Json Web Tokens jwt.io

 https://jwt.io/

JSON Web Tokens are an open, industry standard RFC 7519 method for representing claims securely between two parties.











Sunday, May 7, 2023

fun_GetLastDteOfTheMonth

 ALTER FUNCTION [pksf].[fun_GetLastDteOfTheMonth] 

(

@MM nvarchar(15),

@Year INT

)

RETURNS DATE

AS

BEGIN


DECLARE @LastDayOfTheMonth DATE, @MonthName nvarchar(100)

if       @MM='1' OR @MM='01'

set @MonthName='Jan'

else if  @MM='2' OR @MM='02'

set @MonthName='Feb'

else if  @MM='3' OR @MM='03'

set @MonthName='Mar'

else if  @MM='4' OR @MM='04'

set @MonthName='Apr'

else if  @MM='5' OR @MM='05'

set @MonthName='May'

else if  @MM='6' OR @MM='06'

set @MonthName='Jun'

else if  @MM='7' OR @MM='07'

set @MonthName='Jul'

else if  @MM='8' OR @MM='08'

set @MonthName='Aug'

else if  @MM='9' OR @MM='09'

set @MonthName='Sep'

else if  @MM='10'

set @MonthName='Oct'

else if  @MM='11'

set @MonthName='Nov'

else if  @MM='12'

set @MonthName='Dec'


SET @LastDayOfTheMonth=  CAST('01-'+@MonthName+'-'+ CAST(@Year as NVARCHAR(5)) AS DATE);

SET @LastDayOfTheMonth= EOMONTH(@LastDayOfTheMonth);

RETURN @LastDayOfTheMonth

END

Sunday, April 30, 2023

Odex-Upwork Portfolio

 






PROFILE::: UPWORK






















Ajax form submit MVC

@using (Ajax.BeginForm("ApproveBatchCollectSheet", "CollectionSheet", new AjaxOptions { HttpMethod = "POST", UpdateTargetId = "result", OnComplete = "OnComplete" }))


 


@using (Ajax.BeginForm("Action", "ControllerName", new AjaxOptions { HttpMethod = "POST", UpdateTargetId = "result", OnComplete = "OnComplete" }))

{


  <div class="modal-footer">

        <button type="submit" tabindex="@maxTabIndex" class="btn btn-primary btn-approve-batch-cs"><i class="fa fa-check"></i> Collect</button>

        <button type="button" tabindex="@maxTabIndex" id="btnCloseModal" class="btn btn-danger" data-dismiss="modal"><i class="fa fa-times"></i> Close</button>

    </div>

}




<script>

    function OnComplete(xhr, status, error) {

        //alert(xhr.responseText);

        $.alert.open(xhr.responseText);

         

        $('#GlobalPopupModal').modal('toggle');

        //reload grid data

        CollectionSheetManager.GetCollectionSheetList();

    }

</script>








Wednesday, April 26, 2023

Portfolio-KHALID

 

Flora Systems Ltd:

Vault management:

Vault Management is a built-in module of Flora Bank. At the beginning of the day, the vault officer pays cash to the teller for daily operation and receives the balance of the cash from the teller, and deposits to the vault at end of the day. The following are covered.  Daily Cash Position in Vault  Teller wise Cash Position  Teller Wise Cash Received Register  Auto Generate Cash Memo  Cash Safe Register


Monday, April 10, 2023

SET 0 in left of string digits

 SELECT  RIGHT('000'+ISNULL(ID_String,''),4), * FROM ExcelData_K

ORDER BY ID




Saturday, April 1, 2023

Excel Float Short Form value fixed

 =TEXT(C2,"00%") 




Now upload excel file to sql server. then remove last 3 characters. Use: =TEXT(C2,"00%")



Delete last 3 Characters in SQL

  DECLARE @String NVARCHAR(100)

    SET @String = '12354851'
    SELECT LEFT(@String, NULLIF(LEN(@String)-1,-1))





Sunday, March 26, 2023

Git Commands For check in Files. 3 Steps

 $ git add .  (git add . for all files changes/New)

$ git commit -m "Changes" (in Master branch changes)


$ git push (Finally push)








Tuesday, February 28, 2023

Get Only Firdays in SQL

 SELECT Fridays = DATEADD(yy, DATEDIFF(yy, 0, GETDATE()), n.num)

FROM (SELECT TOP 366 num = ROW_NUMBER() OVER(ORDER BY a.NAME)-1 FROM dbo.syscolumns a, dbo.syscolumns b) n

WHERE DATENAME(weekday, DATEADD(yy, DATEDIFF(yy, 0, GETDATE()), n.num)) = 'Friday'





Sunday, January 15, 2023

epoch date convert in javascript

 epoch date is generally in seconds and milliseconds.

sample:   /Date(1665424800000)/


javascript code to convert in readable date:  

var lsad = String(LoanSanctionApproveDate);

        var lsadUnixDate = lsad.slice(6, 19);

        var lsadToInt = parseInt(lsadUnixDate);

        var loanSancAprvDate = new Date(lsadToInt).toLocaleDateString('es-CL');

Sunday, January 1, 2023

Insert INTO Table From Storedprocedure

 Insert into Table From stored procedure execution

  Insert INTo PFStatement_Data

  EXEC GCPF.SP_RPT_GetProvidentStatement '29226', '31 December, 2021', 1  

Screen Record

 Windows Screen Record WindowsKey+ Alt + R Recording Starts.