Wednesday, April 10, 2024

Need detail for ESI

ESI-- Date of joining Aadhar card Mobile number Father name/Nominee detail Bank detail(IFSC Code and account number)

Tuesday, April 9, 2024

Mastering Print Functionality in Web Development with jQuery

Mastering Print Functionality in Web Development with jQuery

In today's blog post, we're going to delve into an essential feature for web applications: print functionality. This is especially useful for applications that involve invoices, reports, or any content that users might need a physical copy of. We’ll explore how to implement this using JavaScript and jQuery with a simple and effective approach.

Understanding the Code

Let’s break down the snippet that makes this magic happen:

var restorepage = $('body').html();
var printcontent = $('#' + el).clone();
$('body').empty().html(printcontent);
window.print();
$('body').html(restorepage);

This piece of code ensures that only the desired content gets printed while temporarily hiding the rest of the page. Here's how it works step-by-step:

Backup the Current Page Content

var restorepage = $('body').html();

We start by saving the current HTML content of the entire body. This allows us to restore it after the printing is done.

Clone the Content to be Printed

var printcontent = $('#' + el).clone();

Here, we clone the HTML content of the element with the ID stored in the variable el. Cloning is essential to keep the original content intact in the DOM.

Replace the Body Content with the Cloned Content

$('body').empty().html(printcontent);

The body of the document is emptied and replaced with the cloned content. Now, only the content we want to print is visible in the body.

Trigger the Print Dialog

window.print();

This command triggers the browser's print dialog, allowing the user to print the current view of the page.

Restore the Original Page Content

$('body').html(restorepage);

Finally, the original content of the body is restored, making the page look as it was before the print action was initiated.

Implementing the Print Functionality

To implement this functionality in your web application, follow these steps:

Include jQuery

Make sure jQuery is included in your project. You can add it via CDN:

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>

Create the Print Function

Add the following JavaScript function to your script:

function printElement(el) {
    var restorepage = $('body').html();
    var printcontent = $('#' + el).clone();
    $('body').empty().html(printcontent);
    window.print();
    $('body').html(restorepage);
}

Add a Print Button

Create a button or link that calls the printElement function when clicked. Make sure to pass the ID of the element you want to print:

<button onclick="printElement('printSection')">Print Content</button>

Mark the Content to Print

Wrap the content you want to print within an element with a specific ID:

<div id="printSection">
    <!-- Content to be printed -->
</div>

Considerations

  • Styles for Print: Ensure that your print styles are properly defined in your CSS. You can use @media print to customize the appearance of your content when printed.
  • Content Cloning: Cloning the content ensures that any interactive elements (like forms or scripts) are not copied over to the print view, preventing potential issues.

By following these steps, you can add robust print functionality to your web application, enhancing its usability and user experience.

Conclusion

Printing web content is a common requirement, and with jQuery, it's a breeze to implement. The code snippet we discussed provides a straightforward method to print specific parts of your web page without any hassle. Try integrating this into your next project and see how it improves the functionality and professionalism of your application.

Tuesday, January 9, 2024

How to Add a Filter to a Lookup Field in Microsoft Dynamics CRM

How to Add a Filter to a Lookup Field in Microsoft Dynamics CRM

In Microsoft Dynamics CRM, there are times when you need to filter the records displayed in a lookup field to show only a subset of the data. This can be achieved using JavaScript to add a pre-search filter. In this blog, we'll walk you through the steps to filter active contacts in a lookup field.

Step-by-Step Guide

Step 1: Create a JavaScript Web Resource

  1. Navigate to CRM:

    Go to your Dynamics CRM environment.

  2. Open the Solution:

    Open the solution where you want to add the JavaScript.

  3. Add a Web Resource:
    • Go to the "Web Resources" section.
    • Click on "New" and create a new JavaScript web resource.
  4. Add the JavaScript Code:

    Copy and paste the following JavaScript code into your new web resource:

    function setActiveContactsFilter(executionContext) {
        var formContext = executionContext.getFormContext();
        var contacts = formContext.getControl("new_activecontacts");
        contacts.addPreSearch(filterActiveContacts);
    }
    
    function filterActiveContacts() {
        var fetchXml = [
            "<filter type='and'>",
            "  <condition attribute='statuscode' operator='eq' value='1' />", // Adjust the value based on your status code for 'Active'
            "</filter>"
        ].join('');
        
        // Get the lookup control
        var lookupControl = Xrm.Page.getControl("new_activecontacts");
        
        // Fetch the view ID and entity name
        var viewId = "{00000000-0000-0000-0000-000000000000}"; // Replace with the actual view ID if required
        var entityName = "contact"; // Replace with the actual entity name if different
    
        // Create the view
        var viewDisplayName = "Filtered Active Contacts";
        var viewIsDefault = true;
        var layoutXml = ""; // Define the layout XML if needed
    
        // Add the view
        lookupControl.addCustomView(viewId, entityName, viewDisplayName, fetchXml, layoutXml, viewIsDefault);
    }

    Save and publish the web resource.

Step 2: Add the JavaScript Web Resource to the Form

  1. Open the Form:

    Open the form where you want to add the lookup filter.

  2. Form Properties:

    Click on "Form Properties".

  3. Add the Web Resource:
    • In the "Form Libraries" section, add the JavaScript web resource you created.
    • In the "Event Handlers" section, add an event handler for the OnLoad event.
    • Set the function name to setActiveContactsFilter.
    • Ensure "Pass execution context as first parameter" is checked.
  4. Save and Publish:

    Save and publish your form changes.

Step 3: Test the Lookup Filter

  1. Open the Form:

    Navigate to the form where you applied the changes.

  2. Verify the Lookup Field:

    Click on the lookup field and verify that it now only displays active contacts.

Conclusion

Adding a filter to a lookup field in Microsoft Dynamics CRM can significantly enhance the user experience by ensuring that users only see relevant records. By following the steps outlined above, you can easily implement a filter for active contacts or any other criteria you require. Happy customizing!

Tuesday, December 26, 2023

Six Essential Principles of Success in Trading

Six Essential Principles of Success in Trading

Success in trading is not just about luck or intuition; it involves a systematic approach grounded in solid principles. Here are six essential principles to guide you on your trading journey:

1. Information

Having a solid grasp of relevant knowledge is crucial. It’s important to stay informed and up-to-date on the latest developments in your field. In trading, this means keeping abreast of market news, trends, and financial data.

2. Planning

Strategic preparation sets the foundation. Planning helps you identify your goals, develop a roadmap to achieve them, and stay on track. A well-thought-out trading plan includes risk management strategies, entry and exit points, and criteria for evaluating trades.

3. Timing

Precision in execution is essential. Timing is critical in achieving success. Knowing when to act and when to wait can make all the difference. This involves understanding market cycles, recognizing patterns, and being patient enough to wait for the right opportunities.

4. Practice

Consistent rehearsal is paramount. Practice helps you hone your skills, build confidence, and prepare for success. Simulated trading, also known as paper trading, can be an effective way to practice without risking real money.

5. Patience

Endurance through challenges is indispensable. Patience is key to overcoming obstacles and persevering through difficult times. Markets can be unpredictable, and having the patience to stick to your plan is essential for long-term success.

6. Results

The culmination of efforts and dedication. Results are the ultimate measure of success. They reflect the hard work, dedication, and perseverance that went into achieving your goals. Regularly review your trading performance to understand what’s working and what needs improvement.

Remember, success is not just about achieving your goals, but also about the journey you take to get there. Keep these principles in mind and you’ll be well on your way to achieving your dreams!

Sunday, September 3, 2023

Automating Data Entry in Tally with PowerShell and Windows Forms

Automating Data Entry in Tally with PowerShell and Windows Forms

Automation can significantly enhance productivity by eliminating repetitive tasks, and PowerShell, combined with Windows Forms, is a powerful tool for such purposes. In this blog post, we'll explore a PowerShell script designed to automate data entry into a form, using data from a CSV file. This script leverages the System.Windows.Forms namespace to simulate keystrokes for data input.

Overview of the Script

The script reads data from a CSV file and simulates keyboard input to enter the data into a form. It follows these steps:

  • Loads the necessary Windows Forms assembly.
  • Reads data from the CSV file.
  • Uses SendKeys to simulate keystrokes for each record in the CSV.

The Script

[void][System.Reflection.Assembly]::LoadWithPartialName('System.Windows.Forms')
Start-Sleep -Seconds 5
Import-Csv C:\Users\ersan\OneDrive\Documents\Data.csv | foreach {
    $_.Date
    [System.Windows.Forms.SendKeys]::SendWait("{F2}")
    [System.Windows.Forms.SendKeys]::SendWait($_.Date)
    [System.Windows.Forms.SendKeys]::SendWait("{ENTER}")
    Start-Sleep -Seconds 1
    [System.Windows.Forms.SendKeys]::SendWait($_.VoucherType)
    [System.Windows.Forms.SendKeys]::SendWait("{ENTER}")
    Start-Sleep -Seconds 1
    [System.Windows.Forms.SendKeys]::SendWait($_.CashType)
    [System.Windows.Forms.SendKeys]::SendWait("{ENTER}")
    Start-Sleep -Seconds 1
    [System.Windows.Forms.SendKeys]::SendWait($_.Amount)
    [System.Windows.Forms.SendKeys]::SendWait("{ENTER}")
    Start-Sleep -Seconds 1
    [System.Windows.Forms.SendKeys]::SendWait("{ENTER}")
    [System.Windows.Forms.SendKeys]::SendWait("{ENTER}")
    [System.Windows.Forms.SendKeys]::SendWait("{ENTER}")
    Start-Sleep -Seconds 1
}

Step-by-Step Explanation

Loading Windows Forms Assembly

[void][System.Reflection.Assembly]::LoadWithPartialName('System.Windows.Forms')

This line loads the System.Windows.Forms assembly, which is required to use the SendKeys class for simulating keyboard input.

Initial Delay

Start-Sleep -Seconds 5

A 5-second delay allows you to switch to the target application where data entry will occur.

Importing the CSV File

Import-Csv C:\Users\ersan\OneDrive\Documents\Data.csv | foreach {
    ...
}

This line imports the CSV file located at the specified path. Each row in the CSV file is processed in the foreach loop.

Simulating Keystrokes

[System.Windows.Forms.SendKeys]::SendWait("{F2}")
[System.Windows.Forms.SendKeys]::SendWait($_.Date)
[System.Windows.Forms.SendKeys]::SendWait("{ENTER}")
Start-Sleep -Seconds 1
  • SendWait("{F2}"): Simulates pressing the F2 key.
  • SendWait($_.Date): Simulates typing the date from the CSV file.
  • SendWait("{ENTER}"): Simulates pressing the Enter key.
  • Start-Sleep -Seconds 1: Adds a delay to ensure the application processes the input.

The same pattern is repeated for VoucherType, CashType, and Amount fields.

Final Enter Key Presses

[System.Windows.Forms.SendKeys]::SendWait("{ENTER}")
[System.Windows.Forms.SendKeys]::SendWait("{ENTER}")
[System.Windows.Forms.SendKeys]::SendWait("{ENTER}")
Start-Sleep -Seconds 1

Additional Enter key presses may be required to complete the form submission or move to the next field.

Customizing the Script

Here are some ways you can customize the script:

  • CSV File Path: Update the path to your CSV file in the Import-Csv cmdlet.
  • Field Names: Ensure that the field names in the script (Date, VoucherType, CashType, Amount) match the column headers in your CSV file.
  • Delays: Adjust Start-Sleep durations based on the responsiveness of your target application.

Conclusion

This PowerShell script provides a simple yet effective way to automate data entry tasks. By leveraging the System.Windows.Forms namespace, you can simulate keystrokes and streamline repetitive data entry processes. Customizing the script to suit your specific needs can save time and reduce errors in data entry.

Feel free to adapt this script to your requirements, and happy automating!

Wednesday, August 2, 2023

Post to send whatsapp messages

[void][System.Reflection.Assembly]::LoadWithPartialName('System.Windows.Forms') Import-Csv C:\Users\ersan\OneDrive\Documents\SamplePS.csv | foreach { $_.File [system.Diagnostics.Process]::Start("chrome","https://wa.me/"+$_.Url+"?text=JSRM") Start-Sleep -Seconds 10 [System.Windows.Forms.SendKeys]::SendWait("{BACKSPACE}") [System.Windows.Forms.SendKeys]::SendWait("{BACKSPACE}") [System.Windows.Forms.SendKeys]::SendWait("{BACKSPACE}") [System.Windows.Forms.SendKeys]::SendWait("{BACKSPACE}") Start-Sleep -Seconds 1 [System.Windows.Forms.SendKeys]::SendWait("+{TAB}") [System.Windows.Forms.SendKeys]::SendWait("{ENTER}") Start-Sleep -Seconds 1 [System.Windows.Forms.SendKeys]::SendWait("{DOWN}") [System.Windows.Forms.SendKeys]::SendWait("{ENTER}") Start-Sleep -Seconds 2 [System.Windows.Forms.SendKeys]::SendWait("C:\Users\ersan\Downloads\ilovepdf_extracted-pages1\"+$_.File) Start-Sleep -Seconds 2 [System.Windows.Forms.SendKeys]::SendWait("{ENTER}") Start-Sleep -Seconds 4 [System.Windows.Forms.SendKeys]::SendWait("{TAB}") [System.Windows.Forms.SendKeys]::SendWait("{TAB}") [System.Windows.Forms.SendKeys]::SendWait("{TAB}") [System.Windows.Forms.SendKeys]::SendWait("{ENTER}") }

Friday, June 23, 2023

Reliance Company

Network 18
Football sports development limited
Reliance Eros Productions LLP
Hathway Cable & Datacom Limited
Den Networks Limited
Reliance Industrial Infrastructure Limited
Hathway Bhawani Cabletel & Datacom Limited
Reliance Jio Infocomm Limited
Jio Platforms Limited
Reliance Retail Limited
Reliance Petroleum Limited
Jio Payments Bank Limited
Mumbai Indians
Alok Industries Limited
Reliance Foundation
Mukesh Ambani Business List
Petro Chemical Business
Telecom Business
Agricultural Business
E-Commerce Business
Digital Media and Broadcasting Business
Online Service Business
Supermarket Chain Business
Reliance Digita
Reliance Fresh
Reliance Smart Bazar
Reliance Digital
Reliance Retail
Reliance trends
Ajio

Featured Post

Links

https://www.examtopics.com/discussions/microsoft/view/52755-exam-pl-600-topic-2-question-4-discussion/ https://www.examtopics.com/discussion...