I need some help regarding rdlc report in mvc 4.
In my project i have a rdlc report when the user clicks on a button. I will show the report in another tab.
When the user clicks on the button how can I send the print request directly to the default printer which is configured in the system environment without showing a print preview dialogue?
ReportingSerivceLib.PrintManager objPrintManager = new PrintManager();
IList<ParameterValue> parameters = new List<ParameterValue>();
parameters.Add(new ParameterValue {
Name = "Sales_Bill_ID",
Value = POS_Sales_Bill_MasterObj.POS_Sales_Bill_Master.Sales_Bill_ID.ToString()
});
var imgname1 = db.POS_Sales_Bill_Master.SingleOrDefault(
a => a.Sales_Bill_ID == POS_Sales_Bill_MasterObj.POS_Sales_Bill_Master.Sales_Bill_ID).ATTRIBUTE1;
parameters.Add(new ParameterValue {
Name = "Barcode_Parameter", Value = path + "/barcode/" + imgname1.ToString()
});
parameters.Add(new ParameterValue {
Name = "Report_Code", Value = "RPT_Sales_Bill_Receipt"
});
parameters.Add(new ParameterValue {
Name = "Logo_Parameter", Value = "abcteskfdk"
});
string Rpt_Folder_Name = System.Configuration.ConfigurationManager.AppSettings["ReportPath"];
objPrintManager.PrintReport(Rpt_Folder_Name + "RPT_Sales_Bill_Receipt", parameters.ToArray(), -1, -1);
Related
I'm facing a strange Issue when I'm inserting or updating an item in SharePoint2019 list which contains a user column the save completes with no errors but the user column always have empty value,
below is my code
context.Load(context.Web, web => web.Lists);
await context.ExecuteQueryAsync();
List RiskList = context.Web.Lists.GetByTitle("Risks");
context.Load(RiskList);
context.Load(RiskList, r => r.Fields);
await context.ExecuteQueryAsync();
ListItem listItem = RiskList.GetItemById(projectRisks.Id);
List<ListItemFormUpdateValue> listItemFormUpdateValue = new List<ListItemFormUpdateValue>();
if (projectRisks.AssignedTo.HasValue)
{
listItem["AssignedTo"] = new FieldUserValue() { LookupId = projectRisks.AssignedTo.Value };
}
if (projectRisks.Owner.HasValue)
{
User OwnerUser = context.Web.SiteUsers.GetById(projectRisks.Owner.Value);
context.Load(OwnerUser);
await context.ExecuteQueryAsync();
listItem["Owner"] = new FieldUserValue() { LookupId = OwnerUser.Id };
}
listItemFormUpdateValue.Add(new ListItemFormUpdateValue() { FieldName = "Category", FieldValue = GetSPSelectedChoiceValue(context, RiskList, "Category", projectRisks.CategoryName).Result });
listItemFormUpdateValue.Add(new ListItemFormUpdateValue() { FieldName = "Status", FieldValue = GetSPSelectedChoiceValue(context, RiskList, "Status", projectRisks.StatusName).Result });
listItem["Contingency_x0020_plan"] = projectRisks.ContingencyPlan;
listItem["Cost"] = projectRisks.Cost;
listItem["Cost_x0020_Exposure"] = string.Empty;
listItem["Description"] = projectRisks.Description;
listItem["DueDate"] = projectRisks.DueDate;
listItem["Exposure"] = projectRisks.Exposure;
listItem["Impact"] = projectRisks.Impact;
listItem["Mitigation_x0020_plan"] = projectRisks.MitigationPlan;
listItem["Probability"] = projectRisks.Probability;
listItem["Title"] = projectRisks.Name;
listItem.ValidateUpdateListItem(listItemFormUpdateValue, false, string.Empty);
listItem.Update();
await context.ExecuteQueryAsync();
as you can see in the AssignTo and in Owner Columns no mater how I try to save the users values the list will take the default value which is null.
I have made sure that there is values in the assigned to and Owner properties and I have tried using the ListItemFormUpdateValue but with no luck.
Thanks in advance
Showing Error Value Cannot be null. While Adding Task from Gantt Chart for ASP.NET MVC with dhtmlxGantt.
An exception of type ‘System.ArgumentNullException’ occurred in mscorlib.dll but was not handled in user code.
Additional Information :Value cannot be null
LINK : dhtmlx Link for Gantt Chart
Heres My Code :
public static List<GanttRequest> Parse(FormCollection form, string ganttMode)
{
// save current culture and change it to InvariantCulture for data parsing
var currentCulture = Thread.CurrentThread.CurrentCulture;
Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
var dataActions = new List<GanttRequest>();
var prefixes = form["ids"].Split(',');
foreach (var prefix in prefixes)
{
var request = new GanttRequest();
// lambda expression for form data parsing
Func<string, string> parse = x => form[String.Format("{0}_{1}", prefix, x)];
request.Mode = (GanttMode)Enum.Parse(typeof(GanttMode), ganttMode, true);
request.Action = (GanttAction)Enum.Parse(typeof(GanttAction), parse("!nativeeditor_status"), true);
request.SourceId = Int64.Parse(parse("id"));
// parse gantt task
if (request.Action != GanttAction.Deleted && request.Mode == GanttMode.Tasks)
{
//--HERE SHOWING ERROR VALUE CANNOT BE NULL--//
request.UpdatedTask = new GanttTasks()
{
GanttTaskId = (request.Action == GanttAction.Updated) ? (int)request.SourceId : 0,
Text = parse("text"),
StartDate = DateTime.Parse(parse("start_date")),
Duration = Int32.Parse(parse("duration")),
Progress = Decimal.Parse(parse("progress")),
ParentId = (parse("parent") != "0") ? Int32.Parse(parse("parent")) : (int?)null,
SortOrder = (parse("order") != null) ? Int32.Parse(parse("order")) : 0,
Type = parse("type")
};
}
// parse gantt link
else if (request.Action != GanttAction.Deleted && request.Mode == GanttMode.Links)
{
request.UpdatedLink = new GanttLinks()
{
GanttLinkId = (request.Action == GanttAction.Updated) ? (int)request.SourceId : 0,
SourceTaskId = Int32.Parse(parse("source")),
TargetTaskId = Int32.Parse(parse("target")),
Type = parse("type")
};
}
dataActions.Add(request);
}
// return current culture back
Thread.CurrentThread.CurrentCulture = currentCulture;
return dataActions;
}
}
I Referred to link provided above and done as stated. But while adding value its shows value cannot be null.
Try setting a default value for task.progress on the client side,
JS:
gantt.attachEvent("onTaskCreated", function(task){
task.progress = 0;
return true;
});
Client doesn't set the default value for progress property of a newly created task, so when you insert task on a backend progress value is null.
And since backend code doesn't validate the value, probably the error fires on this line:
Progress = Decimal.Parse(parse("progress")),
Setting a default value on the client, as shown above, or checking for null on the server should fix the issue
How we can show "No Data Available" message in RDLC Reports via Resources files if no data is found. Currently we are reflecting message from NoRowsMessage property for a table, matrix, or list
(https://technet.microsoft.com/en-us/library/cc645968.aspx).
But we want to show it via Resource files and C# code rather then setting it from Properties of Table. Can anyone please assist. The code (Page_Load) of our control page (.ascx)is mentioned below:
private void Page_Load(object sender, EventArgs e)
{
var presenter = (ReportPresenter)Model;
reportViewer.ProcessingMode = ProcessingMode.Local;
reportViewer.Visible = true;
var rdlcPath = "~/ReportsRDLC/EmployeeData.rdlc";
if(presenter.ReportFilter.GroupOption == Resources.Date)
{
rdlcPath = "~/ReportsRDLC/EmployeeDatebyDate.rdlc";
}
groupOption.SelectedValue = presenter.ReportFilter.GroupOption;
const string DataSetName = "EmployeeDataSet";
reportViewer.LocalReport.ReportPath = HttpContext.Current.Server.MapPath(rdlcPath);
var dataSource = new ReportDataSource(DataSetName, presenter.EmployeeDetails);
reportViewer.AsyncRendering = false;
reportViewer.SizeToReportContent = true;
reportViewer.ShowPrintButton = false;
reportViewer.ShowRefreshButton = false;
reportViewer.ShowToolBar = true;
reportViewer.Height = 600;
reportViewer.Width = 400;
reportViewer.ShowPageNavigationControls = false;
reportViewer.ShowFindControls = false;
reportViewer.ShowZoomControl = false;
reportViewer.LocalReport.DataSources.Add(dataSource);
}
Perhaps you could send the message as a parameter.
You can tell if the report will be empty depending if presenter.EmployeeDetails is empty.
ReportParameter[] myParameters = new ReportParameter[1];
myParameters[0] = new ReportParameter("pEmptyMessage", presenter.EmployeeDetails.Any() ? "No Data Available" : string.Empty);
reportViewer.LocalReport.SetParameters(myParameters);
On your report you can then display this message as you please, using the parameter. You can even place it in a textbox and decide whether to display it based on the value.
I hope this is of use to you.
Edit: I forgot to mention that you should add the report parameter with the correct name to your reporter:
In the reporter you can then use the parameter as followed : [#pEmptyMessage]
=Parameters!pEmptyMessage.Value
The code seems to run. I don't get any error messages, but an invoice does not appear in QB after I sync. The code is basically this (http://pastebin.com/y7QENxeX) with a few (presumably) minor changes as noted. I'm able to create Accounts and Customers so I believe the basic infrastructure of my app is good. I don't understand why I'm stuck on invoices. I think my customerID is 2. I only have 5 in my company right now. And I think my itemID is 1 as I only have one in QB right now.
Any and all help is greatly appreciated.
Intuit.Ipp.Data.Qbd.PhysicalAddress physicalAddress = new Intuit.Ipp.Data.Qbd.PhysicalAddress();
physicalAddress.Line1 = "123 Main St.";
physicalAddress.Line2 = "Apt. 12";
physicalAddress.City = "Mountain View";
physicalAddress.CountrySubDivisionCode = "CA";
physicalAddress.Country = "USA";
physicalAddress.PostalCode = "94043";
physicalAddress.Tag = new string[] { "Billing" };
Intuit.Ipp.Data.Qbd.InvoiceHeader invoiceHeader = new Intuit.Ipp.Data.Qbd.InvoiceHeader();
invoiceHeader.ARAccountId = new Intuit.Ipp.Data.Qbd.IdType() { idDomain = Intuit.Ipp.Data.Qbd.idDomainEnum.QB, Value = "37" };
invoiceHeader.ARAccountName = "Accounts Receivable";
// original code : invoiceHeader.CustomerId = new IdType() { idDomain = idDomainEnum.NG, Value = "3291253" };
invoiceHeader.CustomerId = new Intuit.Ipp.Data.Qbd.IdType() { idDomain = Intuit.Ipp.Data.Qbd.idDomainEnum.QB, Value = "2" };
invoiceHeader.Balance = (decimal)100.00;
invoiceHeader.BillAddr = physicalAddress;
invoiceHeader.BillEmail = "detroit#tigers.com";
invoiceHeader.CustomerName = "Detroit Tigers";
invoiceHeader.DocNumber = "1234567";
invoiceHeader.DueDate = DateTime.Now;
invoiceHeader.ShipAddr = physicalAddress;
invoiceHeader.ShipDate = DateTime.Now;
invoiceHeader.TaxAmt = (decimal)5;
invoiceHeader.TaxRate = (decimal).05;
invoiceHeader.ToBeEmailed = false;
invoiceHeader.TotalAmt = (decimal)105.00;
List<Intuit.Ipp.Data.Qbd.InvoiceLine> listLine = new List<Intuit.Ipp.Data.Qbd.InvoiceLine>();
//Loop for multiple invoice lines could be added here
Intuit.Ipp.Data.Qbd.ItemsChoiceType2[] invoiceItemAttributes = { Intuit.Ipp.Data.Qbd.ItemsChoiceType2.ItemId, Intuit.Ipp.Data.Qbd.ItemsChoiceType2.UnitPrice, Intuit.Ipp.Data.Qbd.ItemsChoiceType2.Qty };
// original code : object[] invoiceItemValues = { new IdType() { idDomain = idDomainEnum.QB, Value = "5" }, new decimal(33), new decimal(2) };
object[] invoiceItemValues = { new Intuit.Ipp.Data.Qbd.IdType() { idDomain = Intuit.Ipp.Data.Qbd.idDomainEnum.QB, Value = "1" }, new decimal(33), new decimal(2) };
var invoiceLine = new Intuit.Ipp.Data.Qbd.InvoiceLine();
invoiceLine.Amount = 66;
invoiceLine.AmountSpecified = true;
invoiceLine.Desc = "test " + DateTime.Now.ToShortDateString();
invoiceLine.ItemsElementName = invoiceItemAttributes;
invoiceLine.Items = invoiceItemValues;
invoiceLine.ServiceDate = DateTime.Now;
invoiceLine.ServiceDateSpecified = true;
listLine.Add(invoiceLine);
Intuit.Ipp.Data.Qbd.Invoice invoice = new Intuit.Ipp.Data.Qbd.Invoice();
invoice.Header = invoiceHeader;
invoice.Line = listLine.ToArray();
Intuit.Ipp.Data.Qbd.Invoice addedInvoice = commonService.Add(invoice);
Chris
You need to read the following information about how QuickBooks for Windows Sync Manager works, how to see if Sync ran correctly, if objects are in an errored state and how to resolve. It could be any number of things. Once a record is inserted into the cloud, it asynchronously downloads to QuickBooks on the desktop, at which time business logic is applied and records are matched from the cloud to the desktop. If there is an issue, sync manager will show a record of the object that failed, why it failed and the object will now be in an error state.
At this point you can review the error and take steps to fix, like revert or update and resubmit. Links to the documentation below.
QuickBooks Sync Manager
Data Sync
Objects in Errored State
Sync Activity
Sync Status
regards
Jarred
I m very much new to the jQuery and AJAX technology. I am trying to create a form which will insert the values in the database without refresh the page. Most of the code are working as expected. But among there are two case which is not working as expected.
I am fetching values through checkbox. When I select only one checkbox it works but when I select multiple checkbox, the value stored in the database as Array.
I want to display a message once the form data submitted succesfully but its not working.
Please find the below respective code for the same.
Jquery:
$('#add').click(function(){
var domain_type = $('#domain').val();
var domain_zone = $('#domain_zone').val();
var client_name = $('#client_name').val();
//var language[] = "";
var lang = new Array();
if(language==1){
//alert("You select one language");
valid = true;
lang = "English";
}else{
//alert("You select multiple language");
var i =0;
$.each($('input[name=lang]:checked'), function(){
lang.push($(this).val());
});
var count = lang.length;
if(count ==1){
alert("You need to select two languages");
var valid = false;
}else if(count>2){
alert("You can select only two languages");
var valid = false;
}else{
valid = true;
}
}
var formMsge = $('#formStatus');
$('#formStatus').html('<img src="./img/loader.gif"> Please wait while adding the data in database.');
$.ajax({
type: "POST",
url: "./test/test.php",
data: {domain_type:domain_type, domain_zone:domain_zone, client_name:client_name, 'lang[]':lang},
success:function(conf){
$('#formStatus').ajaxComplete(
function(event,request){
if(conf=="OK"){
$('#formSuccess').show();
$('#addClient').hide();
}else{
$('#formError').show();
$('#forError').text("Please try again");
}
}
);
}
});
return false;
});
test.php:
include('../../classes/access_user/all.class.inc.php');
echo $workstream->addClient()
;
php class file:
public function addClient(){
$domain_type = isset($_POST['domain_type'])?$_POST['domain_type']:'';
$domain_zone = isset($_POST['domain_zone'])?$_POST['domain_zone']:'';
$client_name = isset($_POST['client_name'])?$_POST['client_name']:'';
$lang = isset($_POST['lang'])?$_POST['lang']:'';
$add_by = 'Robindra Singha';
$add_on = date("Y-m-d");
if(isset($domain_type) || isset($domain_zone) || isset($client_name) || isset($lang)){
$sql = "INSERT INTO client_list (domain_type_id, client_name, domain_zone, language, add_on, add_by, last_update_on, last_update_by) VALUES('$domain_type','$client_name','$domain_zone','$lang','$add_on','$add_by','$add_on','$add_by')";
$res = mysql_query($sql) or die(mysql_error());
if(mysql_inserted_id() != 0){
$msg = "OK";
}else{
$msg = "System face an issue while adding client details!";
}
}else{
$msg = "System face an issue while adding client details, please try again!";
}
return $msg;
}
In above code, my issue is checkbox value are not able to pass when I select the multiple checkbox, second I am not able to display any text once the form is successfully submit. Except this two issues, my code able to insert the information successfully. I would be glad if any one guide me in completing the work properly. Thank you in advance for your kind support.
Note: I am not able to add the HTML file as i paste here, it display as normal text. please suggest.